# How to solve a quadratic equation that contains a non constant trigonometric component?

I have the following equation that I need to solve and find its roots:

$$x^{2}-2x-\sin \frac{\pi x}{2}=0$$

I treid to solve it as so:

let $$z=\sin \frac{\pi x}{2}$$ Then solving the quadratic equation: $$x^{2}-2x-z=0$$ $$x=\frac{-b\pm \sqrt{b^2-4ac}}{2a}$$ $$x=\frac{2\pm \sqrt{4+4z}}{2}$$ $$x=1\pm \sqrt{1+z}$$ $$x=1\pm \sqrt{1+\sin \frac{\pi x}{2}}$$ $$(x-1)^2=1+\sin \frac{\pi x}{2}$$ $$x^{2}-2x-\sin \frac{\pi x}{2}=0$$

And back to square one!

Is it possible to solve it without using calculator or computer software? I know the roots should be 0 and 2 but how to prove it?.

• Hint: once you found the two obvious solutions, try to prove that there are no others.
– dxiv
Nov 2 '16 at 17:32
• @dxiv What if the soloutions were not obvious? is there no way of solving this equation? Nov 2 '16 at 17:52
• There is no closed form in the general case, though you can still determine the number and approximate ranges of the roots. Take for example $x + 1 - 3 \sin x = 0$.
– dxiv
Nov 2 '16 at 17:56

$x=0$ and $x=2$ are the only real solutions. Since $\left|\sin(\cdot)\right|\leq 1$, we have $$f(x)= x^2-2x+\sin\left(\frac{\pi x}{2}\right) \geq x^2-2x-1$$ and every zero of $f(x)$ belongs to the interval $I=\left[-\frac{1}{2},\frac{5}{2}\right]$. Over such interval $f(x)$ is a convex function, since $f''(x)>0$. It follows that $f(x)$ cannot have more than two roots in $I$. Since $x=0$ and $x=2$ are roots in such interval, they are the only real roots of $f(x)$.

• How did you find the interval $[-\frac{1}{2},\frac{5}{2}]$? Nov 2 '16 at 17:54
• @razzak: educated guess. I needed an interval of convexity of $f$ enclosing all the possible roots. Such interval works. Nov 2 '16 at 17:54

Hint:

Given the solution $x=2$, we want to consider values of $x$ bigger than this. If we graph the function, we get a curve resembling a parabola that seems to be positive for $x>2$.

Let's look at the case for $x$ between $2$ and $4$. Clearly $0<x^2-2x<8$ but we can also see that $\sin\left(\frac{\pi x}{2}\right)$ is negative here. So when we subtract the $\sin\left(\frac{\pi x}{2}\right)$ term here, we increase the value of the function. So $0<x^2-2x-\sin\left(\frac{\pi x}{2}\right)$ when $2<x<4$.

Now let's examine the case for $x>4$. Since $x^2-2x>8$, and $\sin\left(\frac{\pi x}{2}\right)>-1$, we can easily see that $x^2-2x-\sin\left(\frac{\pi x}{2}\right)>7$.

So then $x^2-2x-\sin\left(\frac{\pi x}{2}\right)>0$ for all $x>2$ so there can't be any roots here as the curve can't cross the axis. Consider how this is symmetrical to $x<0$ and then consider $0<x<2$.