# 3 Dimensional Law of Cosines? Magnetic Vector Potential Problem

I am working on a problem similar to one in my textbook - however, I am having an issue understanding the example. Can someone explain the formulas from this picture? I am confused about using the law of cosines with an angle that is seemingly out of the plane of the triangle.

\begin{align} {R}^2& ={r}^2 + {a}^2 - 2ra\cos{\psi}\\ ra\cos{\psi}& = ra\sin{\theta}\cos{\phi'} \end{align}

For me this is easiest to see by introducing some explicit coordinates. Work on a cartesian reference frame whose origin is at the center of the loop, with the $$z$$ axis along the loop axis and the $$x$$-$$z$$ plane going through the point $$A$$. Thus, you have four points of interest:

• $$\vec A = r(\sin(\theta),0,\cos(\theta))$$
• the origin, $$\vec 0$$
• $$\vec P = a (\cos(\phi'),\sin(\phi'),0)$$
• and finally the projection $$\vec A_\perp = r(\sin(\theta),0,0)$$ of $$\vec A$$ onto the plane of the loop.

The diagram shows two triangles:

• $$\triangle \vec A\vec A_\perp \vec 0$$, with a right angle at $$\vec A_\perp$$
• $$\triangle \vec A \vec P \,\vec 0$$ with the sides $$\vec 0\vec P$$ and $$\vec 0\vec A$$ forming an angle $$\psi$$ at $$\vec 0$$.

The two formulas you give correspond to the following:

• The relationship $${R}^2={r}^2+{a}^2-2ra\cos(\psi)$$ is the cosine rule applied to $$\triangle \vec A \vec P \,\vec 0$$ with the angle at $$\vec 0$$
• The relationship $$ra\cos{\psi}= ra\sin(\theta)\cos(\phi')$$ is a re-expression of the inner product $$\vec A \cdot \vec P$$:

• on the one hand, we know that $$\vec A\cdot \vec P = |\vec A| \, |\vec P| \cos(\angle\vec A\vec 0 \vec P) = ra\cos(\psi)$$
• on the other hand, from their explicit cartesian components, \begin{align} \vec A\cdot \vec P & =(r\sin(\theta),0,r\cos(\theta)) \cdot (a\cos(\phi'),a\sin(\phi'),0) \\ & = ra\sin(\theta)\cos(\phi'). \end{align}

Putting both expressions together gives you the identity you want.

Having said all of which, if what you're really after is the identity $${R}^2={r}^2+{a}^2-2ra\sin(\theta)\cos(\phi'),$$ and you're willing to establish a cartesian frame, then it's much simpler to go for this from the beginning, and specifically to forgo the use of the cosine rule by realizing that it is simply the classical geometer's version of the algebraic identity $$|\vec a - \vec b|^2 = (\vec a - \vec b)\cdot(\vec a - \vec b)= |\vec a|^2 +|\vec b|^2 - 2 \vec a\cdot \vec b.$$ Applying this to $$\vec a = A$$ and $$\vec b = \vec P$$ you get $$|\vec A - \vec P|^2 = |\vec A|^2 +|\vec P|^2 - 2 \vec A\cdot \vec P$$ which simplifies to $${R}^2={r}^2+{a}^2-2ra\sin(\theta)\cos(\phi'),$$ with the dot product coming from the explicit cartesian calculation above, and the LHS just being the definition of $$R$$.

There are two triangles in this picture. The one starting at the origin of the circular plane connecting to point $$A$$ and consisting of the two dashed lines. The second triangle starts once again at the origin and consists of line $$r$$ to point $$A$$, then from point $$A$$ along line $$R$$ to the edge of the disk and inward along line a to the center. It's just the standard law of cosines applied to the second triangle.

• But if the second triangle is put directly into a 2d plane, the angle $\psi$ wouldn't appear, as it is out of the plane - no? Isn't standard law of cosines for interior angles of the triangle? – lumicoh Oct 2 '19 at 17:00
• No the angle psi is the angle between the sides a and r. – spacegirl1923 Oct 2 '19 at 17:02
• Phi prime is the angle swept out from the dashed line to a, theta from what I would call the z axis to the vector r. – spacegirl1923 Oct 2 '19 at 17:04
• I see that, but then wouldn't you need to project r and R into the plane of the circle (xy plane) by multiplying $\sin{\theta}$? If not, why? – lumicoh Oct 2 '19 at 17:06
• Welcome to the site! Note that we have MathJax enabled, so you get a basically-complete set of basic LaTeX to do math. You presumably don't need a tutorial, but if you want one there's a good one here. – Emilio Pisanty Oct 2 '19 at 17:43

Try to prove the more general relation in Figure-02. It will be very useful, as for the composition of two rotations around not collinear axes in Figure-04.

to solve this problem, first choose coordinate system and draw a "good" picture

from hear you can calculate what ever you need.

$$\vec{a}=a \begin{bmatrix} \cos(\phi') \\ \sin(\phi') \\ 0 \\ \end{bmatrix}$$

$$\vec{r}=r \begin{bmatrix} \sin(\theta) \\ 0 \\ \cos(\theta) \\ \end{bmatrix}$$

and $$\vec{R}=\vec{r}-\vec{a}$$

to calculate the angle $$\psi$$ , first rotate the coordinate system about the z axes and bring x parallel to x', in this coordinate system ($$x'\,,y'\,,z'$$) is

$$\cos(\psi)=\frac{x'}{{r}}$$

where $${x'}$$ the component of the vector $$\vec{r}$$ given in the ($$x'\,,y'\,,z'$$) system

$$\begin{bmatrix} x' \\ y' \\ z' \\ \end{bmatrix}=\left[ \begin {array}{ccc} \cos \left( \phi' \right) &+\sin \left( \phi' \right) &0\\ -\sin \left( \phi' \right) &\cos \left( \phi' \right) &0\\ 0&0&1\end {array} \right] \begin{bmatrix} r\sin(\theta) \\ 0 \\ r\cos(\theta) \\ \end{bmatrix}$$

$$\Rightarrow$$

$$\cos(\psi)=\frac{r\sin(\theta)\,\cos ( \phi' )}{r}=\sin(\theta)\,\cos ( \phi' )$$

this is your equation (2)