# Calculate angle between skew vectors

I want to use Mathematica to calculate the angle between two vectors (say a and b) that don't lie in the same plane. The vectors are of the same length (156) have a dot product with a unit vector that's normal to a plane that their projections lie that's the same (90). Their projection vectors onto this plane are denoted by p and q respectively. The angle between p and q is 120 degrees.

$Assumptions = (a | e) ∈ Vectors[3, Reals] && e.e == 1 && a.e == b.e == 90 && Sqrt[a.a] == 156 == Sqrt[b.b]; p = a - (a.e) e; q = b - Dot[b, e] e; Simplify[TensorExpand[a.b], Sqrt[a.a] == 156 == Sqrt[b.b]]  ## 1 Answer You should also include b in your assumptions! $Assumptions = (a | b | e) ∈ Vectors[3, Reals] && e.e == 1 &&a.e == b.e == 90 && a.a == 156^2 == b.b;
p = a - (a.e) e;
q = b - (b.e) e;


Now the condition concerning p.q can be evaluated

cond=Simplify[TensorExpand[p.q == Sqrt[p.p] Sqrt[q.q] Cos[120 °]]]
(*18 + a.b == 0*)


Knowing a.byou can evalaute the angle between a,b!

cosα = (a.b/Sqrt[a.a b.b] /. Solve[cond, a.b][[1]])
(*-(18/Sqrt[a.a b.b])*)

• Does the 1 in Solve[cond, a.b][[1]] refer to in[1] the global conditions? I am struggling with mathematica with these in[] as I can not reset the number (to get in[1] for that line) and the result does not show numerically as it is not using the lengths of a and b in the final line of code. – Megamatics Nov 13 '18 at 11:14
• No! Without [[1]] Solve returns double list-brackets. – Ulrich Neumann Nov 13 '18 at 11:30
• I don't know why Mathematica doesn't simplifies the result -(18/Sqrt[a.a b.b]) completely. – Ulrich Neumann Nov 13 '18 at 11:42