<s>[INST] How to find the dot product using the law of cosines I'm working with the following problem:
We have a triangle with sides $AB=3$ and $BC=2$, the angle $ABC$ is 60 degrees. Find the dot product $AC \cdotp AB$
Since we don't actually know the side $AC$ my first step is to calculate this side via the law of cosines.
$$AC^2=AB^2 +BC^2 -2AB\cdot BC\cos x$$
$$\implies AC^2=3^2 +2^2 -2\cdot2\cdot3\cos 60^\circ$$
$$\implies AC^2=9 +4 -12\cdot0.5$$
$$\implies AC^2=13-6=7$$
$$\implies AC=\sqrt 7.$$
My next step is to calculate the angle $BAC$; we should be able to use the law of cosines here as well:
$$BC^2=AB^2+AC^2-2\cdot AB\cdot AC\cos x$$
$$\implies4=9+(\sqrt 7)^2 -2\cdot3\sqrt 7\cos x$$
$$\implies4=9+7 -6\sqrt 7\cos x$$
$$\implies-2=-6\sqrt 7\cos x$$
$$\implies\frac{1}{3}=\sqrt 7\cos x$$
$$\implies\frac{1}{3\sqrt 7}=\cos x.$$
If we want to calculate our dot product using only the vector lengths, we would use the fact that $A\cdotp B=|A||B|\cos x$, which in this case would mean that:
$$AB \cdot AC=3\sqrt7\frac{1}{3\sqrt 7}=1,$$
which is quite wrong since the answer is supposed to be $12$.
Can someone please tell me where I've made a mistake?
In the proposed solution another method seem to be used. The textbook claims that $AB \cdotp AC = AB \cdotp (AB + BC)=AB \cdotp AB + AB \cdotp BC = |AB|^2 + |AB||BC|cos(60)=9+6*\frac{1}{2}=12$
 [/INST] $$\vec{AB}=\vec{AC}+\vec{CB}$$
and
$$\vec{AC}\cdot\vec{AB}=\vec{AB}^2-\vec{CB}\cdot\vec{AB}=9-3\cdot2\cdot\cos60°=6.$$
</s>