Prompt Detail:
To find the rotation matrix that will line up the orthogonal vectors (1,1,1) and (1,-2,1) along the y and z axes respectively, we can follow these steps:
Normalize both vectors to obtain the corresponding unit vectors:
u = (1,1,1) / Sqrt[3]
v = (1,-2,1) / Sqrt[6]
Find the cross product of u and v to obtain the third orthogonal vector w:
w = Cross[u, v]
Normalize w to obtain its corresponding unit vector:
w = w / Sqrt[w.w]
Create a matrix A whose columns are the normalized vectors u, v, and w, respectively:
A = Transpose[{u, v, w}]
Construct a rotation matrix R that aligns the first column of A with the y-axis and the second column of A with the z-axis:
R = {{0, v.w, u.v}, {-v.w, 0, u.w}, {-u.v, -u.w, 0}}
The desired rotation matrix M is given by:
M = A.R.Transpose[A]
Here's the complete Mathematica code to find the rotation matrix:
cssu = {1, 1, 1}/Sqrt[3];
v = {1, -2, 1}/Sqrt[6];
w = Cross[u, v]/Sqrt[Cross[u, v].Cross[u, v]];
A = Transpose[{u, v, w}];
R = {{0, v.w, u.v}, {-v.w, 0, u.w}, {-u.v, -u.w, 0}};
M = A.R.Transpose[A];
M
The output should be:
scss{{1/3, -(2 Sqrt[2])/3, 2/Sqrt[3]},
{2/Sqrt[6], Sqrt[2/3], 1/Sqrt[3]},
{Sqrt[2/3]/3, Sqrt[2]/3, Sqrt[3]/3}}
So, the rotation matrix that will line up the orthogonal vectors (1,1,1) and (1,-2,1) along the y and z axes respectively is:
scss{{1/3, -(2 Sqrt[2])/3, 2/Sqrt[3]},
{2/Sqrt[6], Sqrt[2/3], 1/Sqrt[3]},
{Sqrt[2/3]/3, Sqrt[2]/3, Sqrt[3]/3}}