Can Bisection Method Find Roots of $x^{2}-4x\sin{x}+(2\sin{x})^{2}$? Let $f(x)=x^{2}-4x\sin{x}+(2\sin{x})^{2}$:

As is illustrated, $f(x)$ is obviously nonnegative for all $x\in\mathbb{R}$. Does bisection method work for this function? Because there are no $a,b\in\mathbb{R}$ such that $f(a)f(b)<0$, then is biscetion method inconclusive or does it produce wrong answers? Is it possible to find the positive root using the said method?
 A: $f(x) = (x - 2 \sin(x))^2$.  You can use the bisection method on $x - 2 \sin(x)$.
Or you can try finding minima of $f(x)$ by using the bisection method on $f'(x)$, and the minima turn out to be roots of $f(x)$.
The bisection method on $f(x)$ can't get started because, as you said, there are no $a$ and $b$.
A: We first note that we can rewrite $f(x)$ as
$$
f(x) = (x - 2 \sin x)^2 = [g(x)]^2
$$
where
$$
g(x) = x - 2 \sin x
$$
Clearly,
$$
f(x) = 0 \iff g(x) = 0
$$
Thus, we can proceed to find the roots of $g$.
We take
$$
a = -{\pi \over 4} = -0.7854, \ \ b = {\pi \over 3} = 0.5236
$$
Note that
$$
g(a) = 0.6288 > 0, \ \ g(b) = -0.4764 < 0
$$
Thus, $g$ has a root in the interval $(a, b)$.
We define
$$
x_0 = {a + b \over 2} = -0.1309
$$
We find that
$$
g(x_0) = 0.1302 > 0
$$
Thus, $g$ has a root in the interval $(x_0, b) =  (-0.1309, 0.5236)$.
We define
$$
x_1 = {a + x_0 \over 2} = 0.1963
$$
We find that
$$
g(x_1) = -0.1938 < 0.
$$
Thus, $g$ has a root in the interval $(x_0, x_1) = (-0.1309, 0.1963)$.
Define
$$
x_2 = {x_0 + x_1 \over 2} =  0.0327
$$
Clearly,
$$
g(x_2) = -0.0327 < 0
$$
Thus, $g$ has a root in the interval $(x_0, x_2) = (-0.1309, 0.0327)$.
Define
$$
x_3 = {x_0 + x_2 \over 2} = -0.0491.
$$
Clearly,
$$
g(x_3) = 0.0490 > 0
$$
Thus, $g$ has a root in the interval $(x_3, x_2) = (-0.0491,  0.0327)$.
We define
$$
x_4 = {x_2 + x_3 \over 2} = -0.0082.
$$
Clearly,
$
g(x_4) = 0.0082 > 0
$$
Thus, $g$ has a root in the interval $(x_4, x_2) = (-0.0082, 0.0327)$.
We define
$$
x_5 = {x_4 + x_2 \over 2} = 0.0123
$$
Clearly, this process can be repeated, and it is easy to see that
the iteration sequence $\{ x_n \}$ converges to
$$
x^\star = 0,
$$
which is a zero of the function
$$
g(x) = x - 2 \sin x
$$
Hence, $ x^\star = 0$ is a zero of $f(x)$ by bisection method.
A: The method consists of building a sequence of intervals $[a_n, b_n]$ that are supposed to contain the root and such that $\lim a_n = \lim b_n$. If you use the original $f$, the method can only converge if, by chance, the root is either one of the $a_n$'s or one of the  $b_n$'s (this depends on the actual coding of the algorithm).
