第22章付録:深層学習のための数学
22.1.8. Determinant22.1.8 行列式
The geometric view of linear algebra gives an intuitive way to interpret a fundamental quantity known as the determinant. Consider the grid image from before, but now with a highlighted region (Fig. 22.1.9).
英語のヒント
線形代数の幾何学的な見方は、行列式として知られる基本的な量を直観的に解釈する方法を与える。前の格子の図を、今度はある領域を強調して考えよう(図22.1.9)。
Fig. 22.1.9図22.1.9
The matrix again distorting the grid. This time, I want to draw particular attention to what happens to the highlighted square.
英語のヒント
行列が再び格子をゆがめる。今回は、強調した正方形に何が起きるかに特に注目してほしい。
Look at the highlighted square. This is a square with edges given by and and thus it has area one. After transforms this square, we see that it becomes a parallelogram. There is no reason this parallelogram should have the same area that we started with, and indeed in the specific case shown here of
英語のヒント
強調した正方形を見よう。これは辺がとで与えられる正方形なので、面積は1である。がこの正方形を変換すると、平行四辺形になることがわかる。この平行四辺形がはじめと同じ面積をもつべき理由はなく、実際、ここに示した次の特定の場合では、
(22.1.27)
it is an exercise in coordinate geometry to compute the area of this parallelogram and obtain that the area is .
英語のヒント
この平行四辺形の面積を計算するのは座標幾何の練習問題であり、面積はになる。
In general, if we have a matrix
英語のヒント
一般に、次の行列があるとき、
(22.1.28)
we can see with some computation that the area of the resulting parallelogram is . This area is referred to as the determinant.
英語のヒント
少し計算すると、できる平行四辺形の面積はであることがわかる。この面積は行列式と呼ばれる。
Let’s check this quickly with some example code.
英語のヒント
例のコードでこれを手早く確かめよう。
torch.det(torch.tensor([[1, -1], [2, 3]], dtype=torch.float32))tensor(5.)The eagle-eyed amongst us will notice that this expression can be zero or even negative. For the negative term, this is a matter of convention taken generally in mathematics: if the matrix flips the figure, we say the area is negated. Let’s see now that when the determinant is zero, we learn more.
英語のヒント
目ざとい人は、この式が0や、さらには負にもなりうることに気づくだろう。負の項については、これは数学で一般にとられている慣習の問題である。行列が図形を裏返すなら、面積の符号が反転するという。では、行列式が0のときにさらに何がわかるかを見よう。
Let’s consider
英語のヒント
次を考えよう。
(22.1.29)
If we compute the determinant of this matrix, we get . Given our understanding above, this makes sense. compresses the square from the original image down to a line segment, which has zero area. And indeed, being compressed into a lower dimensional space is the only way to have zero area after the transformation. Thus we see the following result is true: a matrix is invertible if and only if the determinant is not equal to zero.
英語のヒント
この行列の行列式を計算すると、になる。上の理解からすると、これは理にかなっている。はもとの図の正方形を線分に押しつぶし、線分の面積は0である。そして実際、より低い次元の空間に押しつぶされることが、変換の後に面積が0になる唯一の方法である。したがって、次の結果が正しいことがわかる。行列が可逆であるのは、行列式が0に等しくないとき、かつそのときに限る。
As a final comment, imagine that we have any figure drawn on the plane. Thinking like computer scientists, we can decompose that figure into a collection of little squares so that the area of the figure is in essence just the number of squares in the decomposition. If we now transform that figure by a matrix, we send each of these squares to parallelograms, each one of which has area given by the determinant. We see that for any figure, the determinant gives the (signed) number that a matrix scales the area of any figure.
英語のヒント
最後のコメントとして、平面上に描かれた任意の図形を想像しよう。計算機科学者のように考えれば、その図形を小さな正方形の集まりに分解でき、図形の面積は本質的には分解に含まれる正方形の数にすぎない。この図形を行列で変換すると、これらの正方形はそれぞれ平行四辺形に送られ、その一つ一つの面積は行列式で与えられる。任意の図形について、行列式は、行列が図形の面積を何倍にするかを表す(符号付きの)数を与えることがわかる。
Computing determinants for larger matrices can be laborious, but the intuition is the same. The determinant remains the factor that matrices scale -dimensional volumes.
英語のヒント
より大きな行列の行列式を計算するのは骨が折れることもあるが、直観は同じである。行列式は、行列が次元の体積を何倍にするかを表す係数のままである。