# Bound on maximum angle between vectors

I have two vectors $\mathbf v_1$ and $\mathbf v_2$:

$$\mathbf v_1 = \begin{pmatrix}x_1\\y_1\\z_1\end{pmatrix}, \mathbf v_2 = \begin{pmatrix}x_2\\y_2\\z_2\end{pmatrix}$$

The components of these vectors each differ by at most a constant $\epsilon$:

\begin{align} |x_2 - x_1| &\le \epsilon\\ |y_2 - y_1| &\le \epsilon\\ |z_2 - z_1| &\le \epsilon\\ \end{align}

The angle $\theta$ between these vectors is given by:

\begin{align} \theta = \arccos \frac{\mathbf v_1 \cdot \mathbf v_2}{\left\| \mathbf v_1 \right\| \, \left\| \mathbf v_2 \right\|} \end{align}

How can I derive a bound on the maximum on the angle between vectors $\mathbf v_1$ and $\mathbf v_2$ only based on the constant $\epsilon$?

• There is no helpful bound as you can achieve any angle using suitably small values of $x_1,x_2,y_1,y_2,z_1,z_2$. It might be different if $\mathbf v_1$ was fixed with $|x_1| + |y_1|+|z_1| \gg \epsilon$ and only $\mathbf v_2$ was variable – Henry Sep 1 '15 at 10:02
• @Henry how would the bound look like if $\mathbf v_1$ was fixed as you suggested? – pistermink Sep 1 '15 at 10:17
• I suspect there are bounds of the form $\dfrac{k\epsilon}{|\mathbf v_1|}$ perhaps with $k$ slightly above $\sqrt 3$ for $|\mathbf v_1| \gg \epsilon$ – Henry Sep 1 '15 at 11:40
• @Henry could you please post this as an answer (with an explanation how you derived this bound) so I can accept this? – pistermink Sep 2 '15 at 12:49

I suspect there are bounds of the form $\dfrac{k\epsilon}{|\mathbf{v}_1|}$ perhaps with $k$ slightly above $\sqrt3$ for $|\mathbf{v}_1|\gg \epsilon$.

This comes from empirically trying to maximise the angle by taking a large $|\mathbf{v}_1|$ and putting a $\pm \epsilon$ cube round it and looking at its eight corners.

Assume that $\mathbf{v}_1$ is fixed and $\mathbf{v}_2$ can be varied within the constraints. Furthermore, assume none of $x_1,y_1,z_1$ are zero, and $\epsilon \ll \min(|x_1|,|y_1|,|z_1|)$.

WLOG consider only $\mathbf{v}_1$ in the positive octant, i.e. $x_1,y_1,z_1>0$ and with $x_1\ge y_1\ge z_1$. The angle between $\mathbf{v}_1$ and $\mathbf{v}_2$ is maximised when the endpoint of $\mathbf{v}_2$ is at one of the vertices of a cube of edge length $2\epsilon$ centered at $(x_1,y_1,z_1)$ and with faces parallel to the coordinate planes. It can be shown that the particular vertex at which the angle is maximum is $(x_1-\epsilon,y_1+\epsilon,z_1+\epsilon)$ if $x\ge(y+z)$; else $(x_1+\epsilon,y_1-\epsilon,z_1-\epsilon)$ if $x\le(y+z)$. In either case, the approximation for the upper bound on angle will be the same.

Then we have for the choice of $(x_1-\epsilon,y_1+\epsilon,z_1+\epsilon)$:

\begin{align} \cos\theta&=\frac{\mathbf{v}_1 \cdot \mathbf{v}_2}{||\mathbf{v}_1||\,||\mathbf{v}_2||} \\[1em] &=\frac{(x_1-\epsilon,y_1+\epsilon,z_1+\epsilon)\cdot(x_1,y_1,z_1)}{||(x_1-\epsilon,y_1+\epsilon,z_1+\epsilon)||\,||(x_1,y_1,z_1)||} \\[1em] &=\frac{x_1(x_1-\epsilon)+y_1(y_1+\epsilon)+z_1(z_1+\epsilon)}{\sqrt{x_1^2+y_1^2+z_1^2}\cdot\sqrt{(x_1-\epsilon)^2+(y_1+\epsilon)^2+(z_1+\epsilon)^2}} \tag{1} \end{align}

Now let $$s_1=x_1-y_1-z_1 \tag{2}$$ and $$s_2=x_1^2+y_1^2+z_1^2 \tag{3}$$ which are fixed by our choice of $\mathbf{v}_1$. Then (1) reduces to

$$\cos\theta=\frac{s_2-s_1\epsilon}{\sqrt{s_2}\cdot\sqrt{s_2-2s_1\epsilon+3\epsilon^2}}$$ so \begin{align} \sec\theta &= \frac{\sqrt{1-2\dfrac{s_1}{s_2}+3\dfrac{\epsilon^2}{s_2}}}{1-\dfrac{s_1}{s_2}\epsilon} = \frac{\sqrt{1-2\dfrac{s_1}{s_2}+\dfrac{s_1^2}{s_2^2}\epsilon^2+\dfrac{(3s_2-s_1^2)}{s_2^2}\epsilon^2}}{\sqrt{1-2\dfrac{s_1}{s_2}\epsilon+\dfrac{s_1^2}{s_2^2}\epsilon^2}} \\[1em] &= \sqrt{1+\frac{\dfrac{(3s_2-s_1^2)}{s_2^2}\epsilon^2}{\left(1-\dfrac{s_1}{s_2}\epsilon\right)^2}} \\[1em] &\approx 1+\frac{(3s_2-s_1^2)}{2s_2^2}\epsilon^2 \tag{4} \end{align}

because $\sqrt{1+x}=1+\frac{1}{2}x+\frac{(\frac{1}{2})(-\frac{1}{2})}{2}x^2+\ldots \approx 1+\frac{1}{2}x$ by the binomial series, and in the denominator $1-\frac{s_1}{s_2}\epsilon \to 1$ as $\epsilon \to 0$.

But the Taylor Series for $\sec\theta$ is:

$$\sec\theta=1+\frac{1}{2}\theta^2+\ldots \approx 1+\frac{1}{2}\theta^2 \tag{5}$$

So equating the approximations in (4) and (5):

$$\theta_{max} \approx \frac{\sqrt{3s_2-{s_1}^2}}{s_2}\,\epsilon \tag{6}$$