【Study Notes】Mathematics for Machine Learning: Linear Algebra (Week 3)

Introduction

This is a study note of the course Mathematics for Machine Learning: Linear Algebra on the coursera. In this part, we will learn what matrices is, and operations in matrices. We can make transformations by using mactrices, and find the inverse of a matrix. In addition, the determinants will be explaned in this section.

Matrix

How matrices transform space

Given a vector r=[xy]r=\begin{bmatrix}x\\y\end{bmatrix} , and a 2×22 \times 2 matrix AA .
Start with Ar=rAr = r'
We know r=[xy]=xe1^+ye2^r = \begin{bmatrix}x\\y\end{bmatrix}=x\hat {e_1} +y\hat{e_2}
where e1^\hat {e_1} and e2^\hat{e_2} are basic vectors, that is e1^=[10]\hat {e_1}=\begin{bmatrix}1\\0\end{bmatrix} and e2^=[01]\hat {e_2}=\begin{bmatrix}0\\1\end{bmatrix}.
Then, we getAr=A(xe1^+ye2^)=xAe1^+yAe2^\begin{aligned}Ar&=A(x\hat {e_1} +y\hat{e_2})\\ &=xA\hat {e_1} +yA\hat{e_2}\end{aligned}
So we have made a transformation by using matrix AA. We change the basic vector e1^\hat {e_1} to Ae1^A\hat {e_1}, and e2^\hat {e_2} to Ae2^A\hat {e_2}.

If we assume matrix A=[abcd]A = \begin{bmatrix}a &b\\c&d\end{bmatrix}.
We get Ae1^=[abcd][10]=[ac]A\hat {e_1}= \begin{bmatrix}a &b\\c&d\end{bmatrix} \begin{bmatrix}1\\0\end{bmatrix}= \begin{bmatrix}a\\c\end{bmatrix}, and Ae2^=[abcd][01]=[cd]A\hat {e_2}= \begin{bmatrix}a &b\\c&d\end{bmatrix} \begin{bmatrix}0\\1\end{bmatrix}= \begin{bmatrix}c\\d\end{bmatrix}.
Finally, we change the basis to the columns of matrix AA.
Then, we can say the basis after changing are the columns of matrix AA.

Types of matrix transformations

Stretching

The matrix associated with a stretch by a factor kk along the x-axis is given by:
[k001]\begin{bmatrix}k &0\\0&1\end{bmatrix}
Similarly, a stretch by a factor kk along is given by:
[100k]\begin{bmatrix}1 &0\\0&k\end{bmatrix}

Squeezing

If the two stretches above are combined with reciprocal values, then the transformation matrix represents a squeeze mapping:
[k001/k]\begin{bmatrix}k &0\\0&1/ k\end{bmatrix}
A square with sides parallel to axes is transformed to a rectangle that has the same area as the square. The reciprocal stretch and compression leave the area invariant.

Rotation

For rotation by an angle θ clockwise about the origin the functional form is x=xcosθ+ysinθx'=x\cos \theta +y\sin \theta and y=xsinθ+ycosθy'=-x\sin \theta +y\cos \theta. Written in matrix form, this becomes:
[cosθsinθsinθcosθ]\begin{bmatrix}\cos\theta &\sin\theta\\-\sin\theta&\cos\theta\end{bmatrix}
Similarly, for a rotation counterclockwise about the origin, the functional form is x=xcosθysinθx'=x\cos \theta -y\sin \theta and y=xsinθ+ycosθy'=x\sin \theta +y\cos \theta the matrix form is:
[cosθsinθsinθcosθ]\begin{bmatrix}\cos\theta &-\sin\theta\\\sin\theta&\cos\theta\end{bmatrix}

Shearing

[1k01]\begin{bmatrix}1 &k\\0&1\end{bmatrix}
or
[10k1]\begin{bmatrix}1 &0\\k&1\end{bmatrix}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章