# Tangent Line to $\sin x+\cos x$

When is the tangent line to $y = \sin x + \cos x$ horizontal?

I have no idea how to solve this problem. Would I use the equation of a tangent line here? Because if so i have no idea how to apply that.

-
where is the derivative 0? – Joseph Skelton Jun 17 '12 at 22:47

Hint 1. A line is horizontal when its slope is $0$.

Hint 2. The slope of the tangent line to $y=f(x)$ at $a$ is $f'(a)$.

-

Hint: $\sin(x)+\cos(x)=\sqrt{2}\sin(x+\pi/4)$

-

A line $y=mx + b$ is horizontal when the slope $m$ is $0$. Also, remember that the tangent line of a (differentiable) function $f$ at $x=x_0$ has slope $f'(x_0)$. So we are looking for the solutions of $(\cos x + \sin x)' =0$.

Since $(\cos x + \sin x)' = -\sin x + \cos x$, we want to find $x$ such that $- \sin x + \cos x = 0$, i.e., $\cos x = \sin x$. We can then proceed by noting that whenever $\cos x = 0$, we'll have $\sin x = \pm \sqrt{1- \cos^2 x} = \pm 1 \neq 0 = \cos x$, and then $x$ won't be a solution. That allows us to divide by $\cos x \neq 0$, and we obtain $\tan x = 1$, with solutions $x = \frac{\pi}{4} + k\pi$, with $k \in \mathbb{Z}$. For those values of $x$ we'll have $f'(x) = 0$, the tangent line will then have null slope, and thus will be horizontal. Can you calculate the tangent lines at those points?

-
Looks great now. – Gigili Jun 17 '12 at 22:55

Recall from calculus that a tangent line's slope is found by $y'=\frac{dy}{dx}$, therefore, we need to find when $\frac{d}{dx}\left(\sin{x}+\cos{x}\right)=0$. Finding the derivative of $\sin{x}+\cos{x}$:

$$\frac{d}{dx}\left(\sin{x}+\cos{x}\right)=\cos{x}-\sin{x}$$

Setting this equal to zero:

$$\cos{x}-\sin{x}=0\implies \cos{x}=\sin{x} \\ \therefore \frac{\sin{x}}{\cos{x}}=\tan{x}=1 \implies x=\tan^{-1}{1}$$

We can now extract the solutions as: $x=\frac{\pi}{4}+n\pi, \forall n\in\mathbb{Z}$. This gives you the solutions for the $x$-positions where your tangent line is horizontal.

Hope this clears things up!

-

Below is the plot of $f(x) = \sin(x) + \cos(x)$ drawn in blue. The tangent lines are drawn in red and pink.

As you can see from the plot, the tangent lines to $f(x)$ is horizontal at the maximum and minimum points. Also, it is again a sinusoidal function with a phase shift and an amplitude greater that $1$. This can be seen from the manipulation below.$$f(x) = \sin(x) + \cos(x) = \sqrt{2} \left( \dfrac1{\sqrt2} \sin(x) + \dfrac1{\sqrt2} \cos(x)\right) = \sqrt{2} \sin(x + \pi/4)$$ Now it should be clear where the maximum and minimum should occur. The maximum value of $\sin(\theta)$ occurs at $\theta = 2n \pi + \dfrac{\pi}{2}$ and the minimum value of $\sin(\theta)$ occurs at $\theta = 2n \pi - \dfrac{\pi}{2}$ and it is at these points the tangent line will be horizontal. Hence, the tangent line to $f(x)$ is horizontal at $$x + \dfrac{\pi}4 = 2n \pi \pm \dfrac{\pi}2$$

-