# Calculus - Finding the minimum vertical distance between graphs

Question:Find the minimum vertical distance between the graphs of $2+\sin x$ and $\cos x$?

In order to find out the required distance, what should I do? It seems that there is a problem if I differentiate the equation $y = 2+\sin x - \cos x$ and solve $x$ when $y=0$. Would anyone mind telling me how to solve it?

• You are proposing solving for $x$ when $\frac{dy}{dx}=0$. You would also want to check (a) whether there are any solutions for $y=0$ i.e. whether the minimum vertical distance is ever zero and the two original graphs cross or touch; and (b) whether cases where $\frac{dy}{dx}=0$ are an absolute minimum or not. – Henry Feb 24 '14 at 11:24
• Note that when the graphs intersect, your $y_1 - y_2$ merely changes sign, and does not achieve $\frac{dy}{dx} = 0$. Instead, you want to consider $(y_1 - y_2)^2$ (or variants). – Calvin Lin Feb 24 '14 at 11:27

Create your distance function $$f(x)=2+\sin x - \cos x$$ and take its derivative $$f'(x)=\cos x+\sin x.$$ The minima and maxima occur where $f'(x)=0$, i.e., $$\sin x=-\cos x.$$ There are trigonometry techniques for finding those points. The maxima occur where the second derivative is negative, and the minima are where the second derivative is positive (if the second derivative were zero it might not be either a maximum or minimum). $$f''(x)=-\sin x+\cos x.$$ You can easily see all this and check your work approximately by plotting the function.
If it isn't clear to you (after a little research) how you can find the solutions to the equation $\sin x=-\cos x$ above, I would suggest asking that as a separate question.