# How can I calculate the dot product of two vectors if I know both dot products with a third vector?

I have three vectors, $a$, $b$, and $c$ in $n$-dimensional space. I want to calculate $a\cdot b$. I know $\lvert a \rvert$, $\lvert b \rvert$, $\lvert c \rvert$, $a\cdot c$ and $b\cdot c$.

Is there a way to do this, preferably without using trig?

I have made some progress. If $\theta$ is the angle between $a$ and $c$, and $\phi$ is the angle between $b$ and $c$, I know that: $$a\cdot b=\lvert a\rvert\lvert b\rvert\cos(\theta-\phi)=\lvert a\rvert\lvert b\rvert\cos\theta\cos\phi+\lvert a\rvert\lvert b\rvert\sin\theta\sin\phi$$ $$=\frac{(a\cdot c)(b\cdot c)}{\lvert c\rvert^2}+\lvert a\rvert\lvert b\rvert\sin\theta\sin\phi$$

I also know that $$\lvert a\rvert^2\lvert c\rvert^2\sin^2\theta=\lvert a\rvert^2\lvert c\rvert^2-(a\cdot c)^2$$ and likewise for $b$, but this doesn't give the sign of the sines.

I think this is possible, but I'm not sure how to do it.

Edit: Okay, I realize now that this is impossible generally. Is it possible in the two-dimensional case?

You cannot.

Take $a,b$ be two unit vectors in $\operatorname{span}(e_1,e_2)$ ($(e_i)_{1\leq i\leq n}$ being the standard orthonormal basis), and $c=e_3$.

Then $\langle a,c\rangle = \langle b,c\rangle = 0$, and you know $\lvert a\rvert = \lvert b\rvert= \lvert c\rvert =1$ by assumption, but $\langle a,b\rangle$ could take any value in $[-1,1]$.

• Great minds think alike. :-) – vadim123 Feb 23 '18 at 3:00
• Wow, sure enough. Thank you both! – ckolon Feb 23 '18 at 3:11
• @ckolon That's not really a good idea to change the question that much after you received two answers. A better and more acceptable solution is to ask a new question. – Clement C. Feb 23 '18 at 4:26
• But again, you may want extra assumptions even in two dimensions. Take $c=0$, for instance... @ckolon – Clement C. Feb 23 '18 at 4:30
• @ckolon (or even, less trivial case, $c=e_1$, $a= \frac{1}{\sqrt{2}}(e_1+e_2)$, $b=\frac{1}{\sqrt{2}}(e_1-e_2)$, $b'=\frac{1}{\sqrt{2}}(e_1+e_2)$. Based on your information, the two pairs $(a,b)$ and $(a,b')$ give the same information, yet the inner products $\langle a,b\rangle$ and $\langle a,b'\rangle$ are very different.) – Clement C. Feb 23 '18 at 4:34

In general, the answer is no.

$$a=(a_1,a_2,0)$$

$$b=(b_1,b_2,0)$$

$$c=(0,0,1)$$

So long as $a_1^2+a_2^2=1=b_1^2+b_2^2$, you will have $|a|=|b|=|c|=1$, and $a\cdot c=b\cdot c=0$. However you can make $a\cdot b$ be anything you want (between $-1$ and $1$).

• How about in the two-dimensional case? – ckolon Feb 23 '18 at 4:24
• @ckolon every elemetn of the third vector $c$ must not be zero – Muhammad Nizami Apr 8 '18 at 6:49

In the two-dimensional case, of course. The dot products of a given vector with two linearly independent vectors determine its coordinates in some coordinate system (the system with those two vectors as basis). Take the rest from there.

A general result in linear algebra is that vectors $v_1,\ldots,v_n$ are linearly independent if and only if their Gramian matrix, i.e. the matrix of their scalar products, is invertible. In the case of two-dimensional vectors $a,b,c$, since they cannot be linearly independent, we get that

$det\begin{pmatrix}a\cdot a & a\cdot b & a\cdot c \\ a\cdot b & b\cdot b & b\cdot c \\ a\cdot c & b\cdot c & c\cdot c\end{pmatrix} = 0$.

You know all these entries except $a\cdot b$, and the above gives you a quadratic equation satisfied by it, leading to two possible solutions.

Unfortunately, the data you have is still not enough to uniquely determine $a\cdot b$. Consider the examples

$a_1 = \begin{pmatrix}0\\1\end{pmatrix},b_1 = \begin{pmatrix}1\\0\end{pmatrix},c_1 = \begin{pmatrix}1\\1\end{pmatrix}$

and

$a_2 = b_2 = \begin{pmatrix}1\\0\end{pmatrix},c_2 = \begin{pmatrix}1\\1\end{pmatrix}$.

In both cases you have $a_i\cdot c_i = b_i\cdot c_i = 1, |a_i|=|b_i|=1, |c_i|=\sqrt{2}$. In general, reflecting $a$ or $b$ with respect to the line given by $c$ changes none of your given data, but does change $a\cdot b$.