POINT
回転行列を簡単に導出する方法を紹介します.- 回転行列は,ベクトルを原点周りに回転したベクトルに写す.
- 回転行列(2次元・3次元)は図をかくと簡単に導出できる.
- これは,行列が単位ベクトルの変換だけで決まることによる.
例えば,上図の2次元回転行列$R$は,
- 図をかくと$R \begin{pmatrix}1\\ 0\end{pmatrix} = \begin{pmatrix}\textcolor{blue}{\cos\theta} \\ \textcolor{blue}{\sin\theta} \end{pmatrix}$,$R \begin{pmatrix}0\\ 1\end{pmatrix} = \begin{pmatrix}\textcolor{red}{-\sin\theta} \\ \textcolor{red}{\cos\theta}\end{pmatrix}$がわかり,
- これらを順番に並べたものが,2次元回転行列$R = \begin{pmatrix}\textcolor{blue}{\cos\theta} & \textcolor{red}{-\sin\theta} \\ \textcolor{blue}{\sin\theta} & \textcolor{red}{\cos\theta} \end{pmatrix}$になる
計算方法だけ知りたい方は,ここまで読めばOKです!
この方法で計算できる理由を知りたい方は,この後も少し読んでみて下さい.
もう少し頑張ると,3次元回転行列も同じ方法で計算できることもわかります.
【関連記事】
- [A]座標軸の回転と変換則 - Notes_JP:「座標軸」を回転させる際のベクトルの成分,基底ベクトルの変換則をまとめています.
- [B]等長変換:回転・反転・Lorentz変換 - Notes_JP:回転行列の一般化として,長さを一定に保つ変換(等長変換)があります.ユークリッド空間の等長変換は,「回転」と「反転」で表されます.
- [C]【行列表示】複素数・四元数・Pauli行列 - Notes_JP:本記事で解説する「行列は単位ベクトルの変換先を並べたものである」という性質から,行列表示(行列表現)が理解できます.
- [D]行列の対角化とは? - Notes_JP:行列表示(行列表現)がわかると,対角化の理解が深まります.
- [Z]TikZ実例集〜2Dグラフ編 - Notes_JP,TikZ実例集〜3D編 - Notes_JP:本記事の図はTeX (TikZ)でつくりました.
回転行列とは
回転行列とは,「ベクトル」を「原点周りに回転させたベクトル」に写す行列です.当然ですが,回転行列には,ベクトルの長さを変えないという特徴があります.ベクトルの長さを保つ変換には,「回転」の他に「反転」があります(関連記事[B]).
導出方法
詳しい方法は後に回し,ここでは2次元に限って説明します.行列
\begin{aligned}
M=
\begin{pmatrix}
m_{11} & m_{12} \\
m_{21} & m_{22}
\end{pmatrix}
\end{aligned}
を考えます.このとき,M=
\begin{pmatrix}
m_{11} & m_{12} \\
m_{21} & m_{22}
\end{pmatrix}
\end{aligned}
\begin{aligned}
\begin{pmatrix}
\textcolor{blue}{m_{11}} & m_{12} \\
\textcolor{blue}{m_{21}} & m_{22}
\end{pmatrix}
\begin{pmatrix}
1 \\
0
\end{pmatrix}
&=
\begin{pmatrix}
\textcolor{blue}{m_{11}} \\
\textcolor{blue}{m_{21}}
\end{pmatrix} \\
\begin{pmatrix}
m_{11} & \textcolor{red}{m_{12}} \\
m_{21} & \textcolor{red}{m_{22}}
\end{pmatrix}
\begin{pmatrix}
0 \\
1
\end{pmatrix}
&=
\begin{pmatrix}
\textcolor{red}{m_{12}} \\
\textcolor{red}{m_{22}}
\end{pmatrix}
\end{aligned}
です.\begin{pmatrix}
\textcolor{blue}{m_{11}} & m_{12} \\
\textcolor{blue}{m_{21}} & m_{22}
\end{pmatrix}
\begin{pmatrix}
1 \\
0
\end{pmatrix}
&=
\begin{pmatrix}
\textcolor{blue}{m_{11}} \\
\textcolor{blue}{m_{21}}
\end{pmatrix} \\
\begin{pmatrix}
m_{11} & \textcolor{red}{m_{12}} \\
m_{21} & \textcolor{red}{m_{22}}
\end{pmatrix}
\begin{pmatrix}
0 \\
1
\end{pmatrix}
&=
\begin{pmatrix}
\textcolor{red}{m_{12}} \\
\textcolor{red}{m_{22}}
\end{pmatrix}
\end{aligned}
つまり,
行列の性質
\begin{aligned}
M
&=
\begin{pmatrix}
\textcolor{blue}{m_{11}} & \textcolor{red}{m_{12}} \\
\textcolor{blue}{m_{21}} & \textcolor{red}{m_{22}}
\end{pmatrix} \\
&=
\begin{pmatrix}
\textcolor{blue}{M
\begin{pmatrix}
1 \\
0
\end{pmatrix}},
\textcolor{red}{M
\begin{pmatrix}
0 \\
1
\end{pmatrix}}
\end{pmatrix} \\
\end{aligned}
M
&=
\begin{pmatrix}
\textcolor{blue}{m_{11}} & \textcolor{red}{m_{12}} \\
\textcolor{blue}{m_{21}} & \textcolor{red}{m_{22}}
\end{pmatrix} \\
&=
\begin{pmatrix}
\textcolor{blue}{M
\begin{pmatrix}
1 \\
0
\end{pmatrix}},
\textcolor{red}{M
\begin{pmatrix}
0 \\
1
\end{pmatrix}}
\end{pmatrix} \\
\end{aligned}
例えば,$M$が回転行列である場合,単位ベクトルの回転を意味する
\begin{aligned}
M
\begin{pmatrix}
1 \\
0
\end{pmatrix},\,
M
\begin{pmatrix}
0 \\
1
\end{pmatrix}
\end{aligned}
がわかれば,回転行列の表式が決まります.そして,この単位ベクトルの回転は図を書けば簡単に求められます.M
\begin{pmatrix}
1 \\
0
\end{pmatrix},\,
M
\begin{pmatrix}
0 \\
1
\end{pmatrix}
\end{aligned}
以下で,実際に見てみましょう.
2次元
2次元回転行列
\begin{aligned}
\left(
\begin{array}{cc}
\textcolor{blue}{\cos\theta}&\textcolor{red}{-\sin\theta}\\
\textcolor{blue}{\sin\theta}&\textcolor{red}{\cos\theta}
\end{array}
\right)\end{aligned}
\left(
\begin{array}{cc}
\textcolor{blue}{\cos\theta}&\textcolor{red}{-\sin\theta}\\
\textcolor{blue}{\sin\theta}&\textcolor{red}{\cos\theta}
\end{array}
\right)\end{aligned}
3ステップに分けて導出します.

STEP
「$x$軸方向の単位ベクトル」を$\theta$回転させたベクトルを求める
上図(左)から簡単にわかるように,「$x$軸方向の単位ベクトル」を$\theta$回転させると
\begin{aligned}
\left(
\begin{array}{c}
1\\
0
\end{array}
\right)
%
\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{blue}{
\left(
\begin{array}{c}
\cos\theta\\
\sin\theta
\end{array}
\right)
}
\end{aligned}
です.\left(
\begin{array}{c}
1\\
0
\end{array}
\right)
%
\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{blue}{
\left(
\begin{array}{c}
\cos\theta\\
\sin\theta
\end{array}
\right)
}
\end{aligned}
STEP
「$y$軸方向の単位ベクトル」を$\theta$回転させたベクトルを求める
同様に上図(右)から,「$y$軸方向の単位ベクトル」を$\theta$回転させると,
\begin{aligned}
\left(
\begin{array}{c}
0\\
1
\end{array}
\right)
%
\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{red}{
\left(
\begin{array}{c}
-\sin\theta\\
\cos\theta
\end{array}
\right)
}
\end{aligned}
です.\left(
\begin{array}{c}
0\\
1
\end{array}
\right)
%
\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{red}{
\left(
\begin{array}{c}
-\sin\theta\\
\cos\theta
\end{array}
\right)
}
\end{aligned}
STEP
STEP1, 2で求めたベクトルを並べる
上で求めた2つのベクトルを並べた行列
\begin{aligned}
\left(
\begin{array}{cc}
\textcolor{blue}{\cos\theta}&\textcolor{red}{-\sin\theta}\\
\textcolor{blue}{\sin\theta}&\textcolor{red}{\cos\theta}
\end{array}
\right)\end{aligned}
が,求めたかった回転行列になっています.\left(
\begin{array}{cc}
\textcolor{blue}{\cos\theta}&\textcolor{red}{-\sin\theta}\\
\textcolor{blue}{\sin\theta}&\textcolor{red}{\cos\theta}
\end{array}
\right)\end{aligned}
3次元
3次元回転行列も,2次元と全く同じ方法で導出できます.座標軸周りの回転
3次元回転行列($x,y,z$軸周り)
\begin{aligned}
\begin{cases}
\, x\text{軸回り:} &
\begin{pmatrix}
1&0&0\\
0&\cos\theta&-\sin\theta\\
0&\sin\theta&\cos\theta
\end{pmatrix} \\[20pt]
\, y\text{軸回り:} &
\begin{pmatrix}
\cos\theta&0&\sin\theta\\
0&1&0\\
-\sin\theta&0&\cos\theta
\end{pmatrix} \\[20pt]
\, z\text{軸回り:} &
\begin{pmatrix}
\cos\theta&-\sin\theta&0\\
\sin\theta&\cos\theta&0\\
0&0&1
\end{pmatrix}
\end{cases}
\end{aligned}
\begin{cases}
\, x\text{軸回り:} &
\begin{pmatrix}
1&0&0\\
0&\cos\theta&-\sin\theta\\
0&\sin\theta&\cos\theta
\end{pmatrix} \\[20pt]
\, y\text{軸回り:} &
\begin{pmatrix}
\cos\theta&0&\sin\theta\\
0&1&0\\
-\sin\theta&0&\cos\theta
\end{pmatrix} \\[20pt]
\, z\text{軸回り:} &
\begin{pmatrix}
\cos\theta&-\sin\theta&0\\
\sin\theta&\cos\theta&0\\
0&0&1
\end{pmatrix}
\end{cases}
\end{aligned}
$z$軸周りに$\theta$回転させる場合を考えると,単位ベクトルはそれぞれ以下のように変換されます:
\begin{aligned}
\begin{pmatrix}
1\\
0\\
0
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{blue}{
\begin{pmatrix}
\cos\theta\\
\sin\theta\\
0
\end{pmatrix}
},\\
%%%%%%%%
\begin{pmatrix}
0\\
1\\
0
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{red}{
\begin{pmatrix}
-\sin\theta\\
\cos\theta\\
0
\end{pmatrix}
},\\
%%%%%%%%
\begin{pmatrix}
0\\
0\\
1
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{green}{
\begin{pmatrix}
0\\
0\\
1
\end{pmatrix}
}.
\end{aligned}
\begin{pmatrix}
1\\
0\\
0
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{blue}{
\begin{pmatrix}
\cos\theta\\
\sin\theta\\
0
\end{pmatrix}
},\\
%%%%%%%%
\begin{pmatrix}
0\\
1\\
0
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{red}{
\begin{pmatrix}
-\sin\theta\\
\cos\theta\\
0
\end{pmatrix}
},\\
%%%%%%%%
\begin{pmatrix}
0\\
0\\
1
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{green}{
\begin{pmatrix}
0\\
0\\
1
\end{pmatrix}
}.
\end{aligned}
したがって,$z$軸周りに$\theta$回転させる3次元回転行列がわかります:
\begin{aligned}
\begin{pmatrix}
\textcolor{blue}{\cos\theta}&\textcolor{red}{-\sin\theta}&\textcolor{green}{0}\\
\textcolor{blue}{\sin\theta}&\textcolor{red}{\cos\theta}&\textcolor{green}{0}\\
\textcolor{blue}{0}&\textcolor{red}{0}&\textcolor{green}{1}
\end{pmatrix}
\end{aligned}
\begin{pmatrix}
\textcolor{blue}{\cos\theta}&\textcolor{red}{-\sin\theta}&\textcolor{green}{0}\\
\textcolor{blue}{\sin\theta}&\textcolor{red}{\cos\theta}&\textcolor{green}{0}\\
\textcolor{blue}{0}&\textcolor{red}{0}&\textcolor{green}{1}
\end{pmatrix}
\end{aligned}
$x$軸,$y$軸周りの回転行列も同じ方法で導出できます.//
任意軸周りの回転(ロドリゲスの回転公式)
任意の軸周りの3次元回転行列(ロドリゲスの回転公式)を導いてみましょう.ベクトル$\boldsymbol{n}$の周りに角度$\theta$回転させる行列は次で与えられます:ロドリゲスの回転公式(隠れている場合はスクロールで表示)
\begin{aligned}
\begin{pmatrix}
\textcolor{blue}{ \cos\theta+n_x^2(1-\cos\theta)}&\textcolor{red}{n_x n_y(1-\cos\theta)-n_z\sin\theta}&\textcolor{green}{n_z n_x(1-\cos\theta)+n_y\sin\theta}\\
\textcolor{blue}{ n_x n_y(1-\cos\theta)+n_z\sin\theta}&\textcolor{red}{ \cos\theta+n_y^2(1-\cos\theta)}&\textcolor{green}{n_y n_z(1-\cos\theta)-n_x\sin\theta}\\
\textcolor{blue}{ n_z n_x(1-\cos\theta)-n_y\sin\theta}&\textcolor{red}{ n_y n_z(1-\cos\theta)+n_x\sin\theta}&\textcolor{green}{\cos\theta+n_z^2(1-\cos\theta)}
\end{pmatrix}
\end{aligned}
\begin{pmatrix}
\textcolor{blue}{ \cos\theta+n_x^2(1-\cos\theta)}&\textcolor{red}{n_x n_y(1-\cos\theta)-n_z\sin\theta}&\textcolor{green}{n_z n_x(1-\cos\theta)+n_y\sin\theta}\\
\textcolor{blue}{ n_x n_y(1-\cos\theta)+n_z\sin\theta}&\textcolor{red}{ \cos\theta+n_y^2(1-\cos\theta)}&\textcolor{green}{n_y n_z(1-\cos\theta)-n_x\sin\theta}\\
\textcolor{blue}{ n_z n_x(1-\cos\theta)-n_y\sin\theta}&\textcolor{red}{ n_y n_z(1-\cos\theta)+n_x\sin\theta}&\textcolor{green}{\cos\theta+n_z^2(1-\cos\theta)}
\end{pmatrix}
\end{aligned}

\begin{aligned}
\boldsymbol{r}^\prime
=& (\boldsymbol{r}\cdot\boldsymbol{n})\boldsymbol{n}
+\left[\boldsymbol{r}-(\boldsymbol{r}\cdot\boldsymbol{n})\boldsymbol{n}\right]\cos\theta \\
&+\left(\boldsymbol{n}\times\boldsymbol{r}\right)\sin\theta\\
=&\boldsymbol{r}\cos\theta
+\boldsymbol{n}(\boldsymbol{r}\cdot\boldsymbol{n})\left(1-\cos\theta\right) \\
&+\left(\boldsymbol{n}\times\boldsymbol{r}\right)\sin\theta
\end{aligned}
となります.この式で$\boldsymbol{r}=\boldsymbol{e}_x,\boldsymbol{e}_y,\boldsymbol{e}_z$とすれば,単位ベクトルを回転させたベクトルを求めることができます.\boldsymbol{r}^\prime
=& (\boldsymbol{r}\cdot\boldsymbol{n})\boldsymbol{n}
+\left[\boldsymbol{r}-(\boldsymbol{r}\cdot\boldsymbol{n})\boldsymbol{n}\right]\cos\theta \\
&+\left(\boldsymbol{n}\times\boldsymbol{r}\right)\sin\theta\\
=&\boldsymbol{r}\cos\theta
+\boldsymbol{n}(\boldsymbol{r}\cdot\boldsymbol{n})\left(1-\cos\theta\right) \\
&+\left(\boldsymbol{n}\times\boldsymbol{r}\right)\sin\theta
\end{aligned}
ここでは,計算方法の一例を示します.上式の各項は
\begin{aligned}
(\boldsymbol{e}_i\cdot\boldsymbol{n})\boldsymbol{n}
&=n_i\boldsymbol{n}\\
\left(\boldsymbol{n}\times\boldsymbol{e}_l\right)_i
&=\sum_{j,k=1}^3\epsilon_{ijk}n_j\left(\boldsymbol{e}_l\right)_k
=\sum_{j=1}^3\epsilon_{ijl}n_j
\end{aligned}
を用いて計算することができます($\epsilon_{ijk}$は完全反対称テンソル(レビ・チビタ記号)).したがって,$\boldsymbol{r}=\boldsymbol{e}_l$を回転させたベクトルの$i$成分は(\boldsymbol{e}_i\cdot\boldsymbol{n})\boldsymbol{n}
&=n_i\boldsymbol{n}\\
\left(\boldsymbol{n}\times\boldsymbol{e}_l\right)_i
&=\sum_{j,k=1}^3\epsilon_{ijk}n_j\left(\boldsymbol{e}_l\right)_k
=\sum_{j=1}^3\epsilon_{ijl}n_j
\end{aligned}
\begin{aligned}
&\left[\boldsymbol{e}_l\cos\theta
+\boldsymbol{n}n_l\left(1-\cos\theta\right)
+\left(\boldsymbol{n}\times\boldsymbol{e}_l\right)\sin\theta
\right]_i \\
&=\delta_{il}\cos\theta
+n_in_l\left(1-\cos\theta\right) \\
&\qquad +\sum_{j=1}^3\epsilon_{ijl}n_j \sin\theta
\end{aligned}
となります.これを$\boldsymbol{r}=\boldsymbol{e}_x,\boldsymbol{e}_y,\boldsymbol{e}_z$に対して具体的に書き下せば&\left[\boldsymbol{e}_l\cos\theta
+\boldsymbol{n}n_l\left(1-\cos\theta\right)
+\left(\boldsymbol{n}\times\boldsymbol{e}_l\right)\sin\theta
\right]_i \\
&=\delta_{il}\cos\theta
+n_in_l\left(1-\cos\theta\right) \\
&\qquad +\sum_{j=1}^3\epsilon_{ijl}n_j \sin\theta
\end{aligned}
\begin{aligned}
\begin{pmatrix}
1\\
0\\
0
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{blue}{
\begin{pmatrix}
\cos\theta+n_x^2(1-\cos\theta)\\
n_x n_y(1-\cos\theta)+n_z\sin\theta\\
n_z n_x(1-\cos\theta)-n_y\sin\theta
\end{pmatrix}
}\\
%%%%%%%%%%%%%%
\begin{pmatrix}
0\\
1\\
0
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{red}{
\begin{pmatrix}
n_x n_y(1-\cos\theta)-n_z\sin\theta\\\
\cos\theta+n_y^2(1-\cos\theta)\\
n_y n_z(1-\cos\theta)+n_x\sin\theta
\end{pmatrix}
}\\
%%%%%%%%%%%%%%
\begin{pmatrix}
0\\
0\\
1
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{green}{
\begin{pmatrix}
n_z n_x(1-\cos\theta)+n_y\sin\theta\\
n_y n_z(1-\cos\theta)-n_x\sin\theta\\
\cos\theta+n_z^2(1-\cos\theta)
\end{pmatrix}
}.
\end{aligned}
\begin{pmatrix}
1\\
0\\
0
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{blue}{
\begin{pmatrix}
\cos\theta+n_x^2(1-\cos\theta)\\
n_x n_y(1-\cos\theta)+n_z\sin\theta\\
n_z n_x(1-\cos\theta)-n_y\sin\theta
\end{pmatrix}
}\\
%%%%%%%%%%%%%%
\begin{pmatrix}
0\\
1\\
0
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{red}{
\begin{pmatrix}
n_x n_y(1-\cos\theta)-n_z\sin\theta\\\
\cos\theta+n_y^2(1-\cos\theta)\\
n_y n_z(1-\cos\theta)+n_x\sin\theta
\end{pmatrix}
}\\
%%%%%%%%%%%%%%
\begin{pmatrix}
0\\
0\\
1
\end{pmatrix}
%
&\overset{\theta\text{回転}}{\longrightarrow}
%
\textcolor{green}{
\begin{pmatrix}
n_z n_x(1-\cos\theta)+n_y\sin\theta\\
n_y n_z(1-\cos\theta)-n_x\sin\theta\\
\cos\theta+n_z^2(1-\cos\theta)
\end{pmatrix}
}.
\end{aligned}
こうして計算したベクトルを順に並べると「ロドリゲスの回転公式」が得られます.//
導出方法(一般化)
すでに2次元の場合に示した性質を一般化します.行列と単位ベクトルの関係
行列は「単位ベクトルの変換先を並べたもの」である.つまり「$i$成分が$1$,それ以外の成分は$0$」の単位ベクトルを
\begin{aligned}
e_i=
\left(
\begin{array}{c}
0 \\
\vdots \\
1\\
\vdots \\
0
\end{array}
\right)
(i~~~
\end{aligned}
と書くとき,行列$M$はe_i=
\left(
\begin{array}{c}
0 \\
\vdots \\
1\\
\vdots \\
0
\end{array}
\right)
(i~~~
\end{aligned}
\begin{aligned}
M=(Me_1,...,Me_n)
\end{aligned}
と表せる.M=(Me_1,...,Me_n)
\end{aligned}
証明(方法1)
冒頭の方法の一般化です.わかりにくい場合は,$2\times2$行列で具体的に計算した,冒頭の証明と比べてみて下さい!ベクトル$Me_i$の$j$成分を,行列計算の定義どおりに計算すると
\begin{aligned}
(Me_i)_j
=\sum_{k=1}^n M_{jk}(e_i)_k
\end{aligned}
です($(e_i)_k$はベクトル$e_i$の$k$成分を表します).ここで,$(e_i)_k$は$k=i$のとき以外$0$なので,(Me_i)_j
=\sum_{k=1}^n M_{jk}(e_i)_k
\end{aligned}
\begin{aligned}
(Me_i)_j=M_{ji}
\end{aligned}
となります.//(Me_i)_j=M_{ji}
\end{aligned}
証明(方法2)
2次元の場合で考えます.$n$次元の場合も同様です.行列$M$をベクトル
\begin{aligned}
\boldsymbol{v}
&=
\begin{pmatrix}
v_{1} \\
v_{2}
\end{pmatrix}
=
v_{1}
\begin{pmatrix}
1 \\
0
\end{pmatrix}
+
v_{2}
\begin{pmatrix}
0 \\
1
\end{pmatrix} \\
&=v_{1}\boldsymbol{e}_{1} + v_{2}\boldsymbol{e}_{2}
\end{aligned}
に作用させると\boldsymbol{v}
&=
\begin{pmatrix}
v_{1} \\
v_{2}
\end{pmatrix}
=
v_{1}
\begin{pmatrix}
1 \\
0
\end{pmatrix}
+
v_{2}
\begin{pmatrix}
0 \\
1
\end{pmatrix} \\
&=v_{1}\boldsymbol{e}_{1} + v_{2}\boldsymbol{e}_{2}
\end{aligned}
\begin{aligned}
M\boldsymbol{v}
&=v_{1}\cdot M\boldsymbol{e}_{1} + v_{2}\cdot M\boldsymbol{e}_{2} \\
&=
(M\boldsymbol{e}_{1},M\boldsymbol{e}_{2})
\begin{pmatrix}
v_{1} \\
v_{2}
\end{pmatrix} \\
&=(M\boldsymbol{e}_{1},M\boldsymbol{e}_{2}) \boldsymbol{v}
\end{aligned}
となります.M\boldsymbol{v}
&=v_{1}\cdot M\boldsymbol{e}_{1} + v_{2}\cdot M\boldsymbol{e}_{2} \\
&=
(M\boldsymbol{e}_{1},M\boldsymbol{e}_{2})
\begin{pmatrix}
v_{1} \\
v_{2}
\end{pmatrix} \\
&=(M\boldsymbol{e}_{1},M\boldsymbol{e}_{2}) \boldsymbol{v}
\end{aligned}
つまり,$M=(M\boldsymbol{e}_{1},M\boldsymbol{e}_{2})$が成り立ちます.//
プログラム
Python (numpy)
import numpy as np def rot(vec, theta): vec = vec.reshape(-1, 1) cos, sin = np.cos(theta), np.sin(theta) R = np.array([ [cos, - sin], [sin, cos] ]) return R @ vec
実行例:
import matplotlib.pyplot as plt theta = np.pi / 4 v = np.array([ [1], [0] ]) Rv = rot(v, theta) fig = plt.figure(figsize = (5, 5), tight_layout = True) ax = fig.add_subplot(1, 1, 1) ax.set_xlim(-2, 2) ax.set_ylim(-2, 2) ax.grid() ax.quiver(0, 0, *v, angles = 'xy', scale_units = 'xy', scale = 1) ax.text(*v, f'v=\n{v}') ax.quiver(0, 0, *Rv, angles = 'xy', scale_units = 'xy', scale = 1) ax.text(*Rv, f'Rv=\n{Rv}') plt.show()