# When is $\sin(x) = \cos(x)$?

How do I solve the following equation?

$$\cos(x) - \sin(x) = 0$$

I need to find the minimum and maximum of this function:

$$f(x) = \frac{\tan(x)}{(1+\tan(x)^2}$$

I differentiated it, and in order to find the stationary points I need to put the numerator equal to zero. But I can't find a way to solve this trigonometric equation.

• For the first : Solve $tan(x)=1$ , Solution $(k+\frac{1}{4})\pi$ – Peter Aug 27 '16 at 21:32
• For the second, substitute $t=\tan(x)$ to get $g(t)=\frac{t}{(1+t)^2}$. You should have no problem to find the extrema of $g(t)$. Since the range of $\tan(x)$ is $\mathbb R$, the extrema of $g(t)$ are also the extrema of $f(x)$. – Peter Aug 27 '16 at 21:41

## 8 Answers

Hint: Take the equation $$\sin(x) = \cos(x)$$ and divide both sides by $\cos(x)$ to get $$\tan(x) = 1$$

Alternatively, using a sum-to-product formula, we can observe that $$\sin(x) - \cos(x) = \sqrt{2}\sin(x - 45^\circ)$$

• ... or more precisely, you get two classes of solutions: solutions to $\tan(x)=1$ and simultaneous solutions to {$\cos(x)=0$ and $\sin(x)=\cos(x)$}. – Hurkyl Aug 28 '16 at 0:43
• I don't understand how this kind of question and answer get so many upvotes, a more difficult problem is to understand why would someone even ask "what is the solution of $\sin(x) = \cos(x)$ " in a mathematic community this is hard to believe – Anonymous Aug 28 '16 at 5:25
• @Anonymous it's about which questions get seen, in the end of the day. A simple question is more likely to be understandable and therefore interesting to the passer-by. Once the question becomes "hot", it gets even more attention. – Omnomnomnom Aug 28 '16 at 5:30
• As Hurkyl said: Be aware that plainly dividing by $\cos(x)$ assumes that your solutions lie where $\cos(x)\not=0$. Adding that second equation ($\cos(x)=0 \land \sin(x)=\cos(x)$) makes your answer a lot more rigorous (even if it isn't going to give solutions). – tomsmeding Aug 28 '16 at 5:45
• @Anonymous: You might be confusing this site with Math overflow. The people who ask questions here on math.se are not (necessarily) mathematicians, they are people who need help with mathematics. Some need help with advanced stuff, some need help with things as elementary as this question. If you were looking for a community of mathematicians, give mathoverflow.net a look. Or you can stay here and acknowledge that people vary in their proficiency in math, and not everyone has to cater to your specific preferred level of sophistication. – Meni Rosenfeld Aug 28 '16 at 8:55

Here's an alternative hint with a more geometrical flavour: what are the angles in an isosceles right-angled triangle?

A direct approach: use the unit-circle definition of sine and cosine.

Consider a unit circle around the origin of a Cartesian plane. Since in this problem $x$ is already in use as an angle, we cannot label the two axes $x$ and $y$ as usual, so let's label them $u$ (on the horizontal axis) and $v$ (on the vertical axis) instead. Then the unit-circle definition says that if we take a point at an angle $x$ radians counterclockwise around the unit circle, the coordinates at that point will be \begin{align} u &= \cos x, \\ v &= \sin x. \end{align}

The equation $\cos x = \sin x$ then tells us that $u = v$, which is the equation of a line at $\frac\pi4$ radians ($45$ degrees) through the origin. But we got these coordinates in the first place as coordinates of a point on the unit circle, so the solution must be at a point where the line $u = v$ intersects the unit circle. Draw a graph, as in the figure below: there are two such points. The coordinates of these points happen to be $\left(\frac{\sqrt2}{2},\frac{\sqrt2}{2}\right)$ and $\left(-\frac{\sqrt2}{2},-\frac{\sqrt2}{2}\right)$, but even without figuring that out, since you know the angle of the line $u=v$ you can easily see the two possible values of $x$ within the range $0$ to $2\pi$ radians ($0$ to $360$ degrees).

• I suggest you augment this answer with a nice graphic, one of these perhaps. – einpoklum Aug 28 '16 at 13:22
• @einpoklum I have now drawn my own figure in order to have one that showed both intersections without showing too many other things. – David K Aug 28 '16 at 14:55
• hurray for symmetry! – einpoklum Aug 28 '16 at 18:55

1) $\cos^2 x + \sin^2 x = 1$

So $2 \cos^2 x = 1$

So $\cos x = \sin x = \pm \sqrt{\frac 12}$

2) $\sin x$ is the adjacent side of a right triangle. $\cos x$ is the opposite side. $\sin x = \cos x$ means the triangle is isoceles. So the base angles are congruent. So $x + x + 90 = 180$.

3) $\sin x = \cos (\frac {\pi}2 -x)$

so $\cos x = \sin x = \cos (\frac {\pi}2-x)$

Can you figure it out now?

There are some quadrant issues to figure out but they aren't hard.

If you have an equation of the form $$\cos f(x)=\sin g(x)$$ you can rewrite it as $$\cos f(x)=\cos\left(\frac{\pi}{2}-g(x)\right)$$ and so $$f(x)=\frac{\pi}{2}-g(x)+2k\pi \qquad\text{or}\qquad f(x)=-\frac{\pi}{2}+g(x)+2k\pi$$

In your particular case, $f(x)=g(x)=x$, so you have $$x=\frac{\pi}{2}-x+2k\pi \qquad\text{or}\qquad x=-\frac{\pi}{2}+x+2k\pi$$ Of course, the second possibility gives no solution; the first case gives $$x=\frac{\pi}{4}+k\pi$$

If your function is $$f(x)=\frac{\tan x}{(1+\tan x)^2}$$ the derivative is \begin{align} f'(x) &=\frac{(1+\tan^2x)(1+\tan x)^2-2(1+\tan x)(1+\tan^2x)\tan x} {(1+\tan x)^4} \\[6px] &=\frac{(1+\tan^2x)(1-\tan x)}{(1+\tan x)^3} \end{align} so it vanishes for $\tan x=1$.

For posterity, here's a unit circle interpretation of the equation $\cos\theta = \sin\theta$, viewing the circle as parametrized by $$x = \cos\theta,\qquad y = \sin\theta.$$ Approach $1$ (Squaring):

$$(\sin x-\cos x)^2=0$$ $$(\sin^2x+\cos^2x)-2\sin x\cos x=0$$ $$1-\sin2x=0$$ $$\sin2x=1$$ $$2x=\frac{\pi}2+2n\pi,n\in\Bbb{N}$$ $$x=\frac{\pi}4+n\pi,n\in\Bbb{N}$$

Approach $2$ (By definition of $\sin x$ and $\cos x$): $$\cos t=\frac{e^{it}+e^{-it}}2=\frac{e^{it}-e^{-it}}{2i}=\sin t$$ $$(1+i)e^{-it}=(1-i)e^{it}$$ $$e^{2it}=\frac{1+i}{1-i}=i$$ $$\cos2t+i\sin2t=i$$ $$\implies\cos 2t=0 \text{ }\cap \sin2t=1$$ $$x=\frac{\pi}4+n\pi,n\in\Bbb{N}$$

$cos(x)=sin(x) \implies x = \pi n-\frac{3\pi}{4}$ where n is an integer.

• Could you edit your answer to share your thoughts on how you arrived at $\pi n - \frac{3\pi}{4}$? – Frenzy Li Aug 28 '16 at 13:13