# How to solve vector equation?

Given the vector relation $$(\mathbf{a}+3 \mathbf{b}) \perp(7 \mathbf{a}-5 \mathbf{b})$$, $$(\mathbf{a}-4 \mathbf{b}) \perp(7 \mathbf{a}-2 \mathbf{b})$$, find the angle between $$\mathbf{a}$$ and $$\mathbf{b}$$.

$$\begin{array}{c} \text{Solving process: } \qquad \because(\mathbf{a}+3 \mathbf{b}) \cdot(7 \mathbf{a}-5\mathbf{b}) = 0,(\mathbf{a}-4 \mathbf{b}) \cdot(7 \mathbf{a}-2 \mathbf{b}) = 0 \\ \therefore \quad 7 \mathbf{a}^{2}+16 \mathbf{a} \cdot \mathbf{b}-15 \mathbf{b}^{2} = 0,7 \mathbf{a}^{2}-30 \mathbf{a} \cdot \mathbf{b}+8 \mathbf{b}^{2} = 0\\ \quad \mathbf{a}^{2} = \mathbf{b}^{2} = 2 \mathbf{a} \cdot \mathbf{b} \\ \Rightarrow \cos \langle \mathbf{a}, \mathbf{b}\rangle = \frac{\mathbf{a} \cdot \mathbf{b}}{\mathbf{a}|\cdot \mathbf{b}|} = \frac{1}{2} \end{array}$$

a = {x1, y1, z1};
b = {x2, y2, z2};
Solve[{7 a . a + 16 a . b - 15 b . b == 0,
7 a . a - 30 a . b + 8 b . b == 0,
cosa == a . b/(Norm[a] Norm[b])},
cosa, {x1, y1, z1, x2, y2, z2}] // FullSimplify


How to use Mathematica to directly solve the above vector equation and find the angle between vector $$\mathbf{a}$$ and vector $$\mathbf{b}$$? I wonder if there is any other easier way.

• What's wrong with your solution? It's straightforward and includes elimination! Commented Feb 24, 2021 at 10:34

Using Eliminate[]:

With[{a = {a1, a2, a3}, b = {b1, b2, b3}},
Eliminate[{(a + 3 b) . (7 a - 5 b) == 0, (a - 4 b) . (7 a - 2 b) == 0,
cang == a . b/(Sqrt[a . a] Sqrt[b . b])}, Join[a, b]]]
4 cang^2 == 1

Solve[%, cang]
{{cang -> -1/2}, {cang -> 1/2}}


Only one of the two possible solutions is valid, however:

{(a + 3 b) . (7 a - 5 b) == 0, (a - 4 b) . (7 a - 2 b) == 0} /.
{a -> {1, 0, 0}, b -> Append[AngleVector[2 π/3], 0]}
{False, False}

{(a + 3 b) . (7 a - 5 b) == 0, (a - 4 b) . (7 a - 2 b) == 0} /.
{a -> {1, 0, 0}, b -> Append[AngleVector[π/3], 0]}
{True, True}