# Solving $\arccos(\frac{x}{r}) + \arccos(\frac{x \cdot d}{r}) = \frac{\pi}{n}$

I'm trying to solve equations of the general form below, where everything aside from $x$ is known.

$$\arccos\left(\frac{x}{r}\right) + \arccos\left(\frac{x \cdot d}{r}\right) = \frac{\pi}{n}$$

For example:

$$\arccos\left(\frac{x}{4.3}\right) + \arccos\left(\frac{x \cdot \frac{2.95}{3.75}}{4.3}\right) = \frac{\pi}{3} \Leftrightarrow x \approx 4.08$$

I guesstimated this one by plotting it, but I can't figure out how to solve it mathematically...

Taking the $\sin$ of both sides gets rid of the $\arccos$, but I'm not sure what to do with the resulting square root:

$$\sin\left(\arccos\left(\frac{x}{r}\right) + \arccos\left(\frac{x \cdot d}{r}\right)\right) = \sin\left(\frac{\pi}{n}\right)$$

$$d \cdot x \sqrt{1 - \frac{x^2}{r^2}} - x \sqrt{1 - \frac{d^2 x^2}{r^2}} = \sin\left(\frac{\pi}{n}\right)$$

$$x\left(d \sqrt{1 - \frac{x^2}{r^2}} - \sqrt{1 - \frac{d^2 x^2}{r^2}}\right) = \sin\left(\frac{\pi}{n}\right)$$

Using $\cos$ instead, I end up with:

$$\arccos\left(\frac{x}{r}\right) = \frac{\pi}{n} - \arccos\left(\frac{x \cdot d}{r}\right)$$

$$\frac{x}{r} = \cos\left(\frac{\pi}{n} - \arccos\left(\frac{x \cdot d}{r}\right)\right)$$

Depending on the value of $n$ this simplifies to a polynomial, for example with $n = 2$:

$$\frac{x}{r} = \sin\left(\arccos\left(\frac{x \cdot d}{r}\right)\right)$$

$$\frac{x}{r} = \sqrt{1 - \frac{x \cdot d}{r}}$$

$$\frac{x^2}{r^2} = 1 - \frac{x \cdot d}{r}$$

$$1 - \frac{d}{r} \cdot x - \frac{1}{r^2} \cdot x^2 = 0$$

But I'm looking to solve these programmatically for $n > 0$.

Apply cosine to both sides and get $$\frac{d x^2}{r^2}-\sqrt{1-\frac{x^2}{r^2}} \sqrt{1-\frac{d^2 x^2}{r^2}}=\cos \left(\frac{\pi }{n}\right)$$ Set $\frac{x^2}{r^2}=z$

The equation becomes $$dz-\sqrt{1-z}\sqrt{1-d^2z}=\cos \left(\frac{\pi }{n}\right)$$

$$d z-\cos \left(\frac{\pi }{n}\right)=\sqrt{(1-z) \left(1-d^2 z\right)}$$

$$\left(d z-\cos \left(\frac{\pi }{n}\right)\right)^2=(1-z) \left(1-d^2 z\right)$$

$$d^2 z^2-2 d z \cos \left(\frac{\pi }{n}\right)+\cos ^2\left(\frac{\pi }{n}\right)=d^2 z^2-d^2 z-z+1$$

$$z \left(d^2-2 d \cos \left(\frac{\pi }{n}\right)+1\right)+\cos ^2\left(\frac{\pi }{n}\right)-1=0$$

$$z=\frac{1-\cos ^2\left(\frac{\pi }{n}\right)}{d^2-2 d \cos \left(\frac{\pi }{n}\right)+1}=\frac{\sin ^2\left(\frac{\pi }{n}\right)}{d^2-2 d \cos \left(\frac{\pi }{n}\right)+1}$$ reset $\frac{x^2}{r^2}=z$

$$x^2= \frac{r^2\sin ^2\left(\frac{\pi }{n}\right)}{d^2-2 d \cos \left(\frac{\pi }{n}\right)+1}$$

hope this can be useful

• Brilliant, thank you! How did you transform eq. 2 into eq. 3? – rthur Oct 19 '17 at 12:45
• @rthur Look again to my answer, I have added some line – Raffaele Oct 19 '17 at 14:15