# Simplifing an equation and solve it for x

I want to simplify an equation.

I have:

$$\sqrt{(x+r*sin(\alpha))^2+(m*x+t-r*cos(\alpha))^2}+r=l$$

and also I know:

$$r=\frac{t+m*x-x*tan(\delta)}{cos(\alpha)+sin(\alpha)*tan(\delta)}$$

If I put the equation of $$r$$ in my other equation I get:

$$\sqrt{(x+\frac{t+m*x-x*tan(\delta)}{cos(\alpha)+sin(\alpha)*tan(\delta)}*sin(\alpha))^2+(m*x+t-\frac{t+m*x-x*tan(\delta)}{cos(\alpha)+sin(\alpha)*tan(\delta)}*cos(\alpha))^2}+\frac{t+m*x-x*tan(\delta)}{cos(\alpha)+sin(\alpha)*tan(\delta)}=l$$

I now have to solve for x and I don't get a solution for it because it is to complicated. So I tried to simplify the equation with Mathcad and solve it then for x but also this gave me an expression which was too long to display and Mathcad cannot show it to me.

Are there any suggestions how to simplify this equation to get a result for x?

Best regards, mk3

• Start simplifying the notations. For example : $r=a+b x$ Apr 6, 2022 at 13:47
• You can solve your second equation easily for x in terms of the other variables. It is of the form $r = \frac{a+bx}{c}$
– Paul
Apr 6, 2022 at 13:50
• @Paul. Same time, same idea. Divide by $c$ and we fully agree. Cheers :-) Apr 6, 2022 at 13:51
• Writing $m:=\tan\mu$, I (with the help of Mathematica) ultimately get $$x=\frac{\cos\mu}{\cos(\alpha+\delta-2\mu)} \left(\;\ell \sin(\delta-\mu) - t \sin(\alpha + \delta - \mu) \pm (\ell \cos(\alpha-\mu) - t \cos\mu)\;\right)$$ This makes me curious about the underlying geometry of the equation. Perhaps it provides a more-direct path to the solution.
– Blue
Apr 6, 2022 at 14:12

It is less complicated than it looks. However, the result is still lengthy.

Your equation for $$r$$ (it is $$r$$ you want to replace) is linear in $$x$$:
$$r= \frac{t+m*x-x*tan(\delta)}{cos(\alpha)+sin(\alpha)*tan(\delta)} = A + B x$$, where $$A = \frac{t}{cos(\alpha)+sin(\alpha)*tan(\delta)}$$ and $$B = \frac{m-tan(\delta)}{cos(\alpha)+sin(\alpha)*tan(\delta)}$$

Replacing $$r$$, your first equation can then be written

$$(x+(A + B x) \sin(\alpha))^2+(m x+t-(A + B x) \cos(\alpha))^2=(l-r)^2 = (l-A - B x)^2$$ which can be slightly simplified, making use of $$\sin(\alpha)^2+ \cos(\alpha)^2 = 1$$: $$x^2 (A^2 + m^2 + 1) + A x (2 B - 2 (\cos(α) (m x + t) - x \sin(α))) + B^2 - 2 B (\cos(α) (m x + t) - x \sin(α)) + 2 m t x + t^2 = (l -(Ax + B))^2$$

so this is a quadratic equation in $$x$$ which can readily be solved:

$$x = \frac{-1/2 \sqrt{(2 A l - 2 A t \cos(α) + 2 B \sin(α) - 2 B m \cos(α) + 2 m t)^2 - 4 (2 A \sin(α) - 2 A m \cos(α) + m^2 + 1) (2 B l - 2 B t \cos(α) - l^2 + t^2)} - A l + A t \cos(α) - B \sin(α) + B m \cos(α) - m t}{2 A \sin(α) - 2 A m \cos(α) + m^2 + 1}$$ Now put $$A$$ and $$B$$ back in. $$\qquad \Box$$

• Wow this was fast and very well explained. It also works. Thank you very much for this detailed explanation! Answer accepted!
– mk3
Apr 6, 2022 at 14:11