Problem: Find out the number of roots of equation $x^2 - \cos x =0$ in the interval $\left[ -\frac{\pi}{2}, \frac{\pi}{2} \right] $.
Solution: n order to find the roots of the equation $x^2 - \cos x$ in $\left[ -\frac{\pi}{2}, \frac{\pi}{2} \right] $, we will plot both these functions and see how many intersections are there in the given interval. Look at the following picture:
Note that, we only have two intersections and hence the equations has two roots.