Opposite signed solutions to same integral?

84 Views Asked by At

Say I have an integral:

$$\int\sqrt{(\sin x - \cos x)^2}\,dx$$

Now this can be evaluated into $\sin(x) - \cos(x)$ or $\cos(x) - \sin(x)$, right? Although, in the end, I'm getting an opposite sign to the questions given in the textbook. The two solutions look different as the signs are opposite, so which one is the right one?

Edit: The Original problem was the integral of $\sqrt{1-\sin2x}$. This could be further expanded into $\sqrt{\sin^2x + \cos^2x-2\sin(x)\cos(x)}$. Now, according to me, this can be written as $\sqrt{(\sin x - \cos x)^2}$ or $\sqrt{(\cos x - \sin x)^2}$. So, am I wrong here?

2

There are 2 best solutions below

5
On BEST ANSWER

Now this can be evaluated into $\sin(x) - \cos(x)$ or $\cos(x) - \sin(x)$, right?

Wrong.

$\sqrt{x^2}$ is not equal to "$x$ or $-x$". It is equal to $|x|$.


Remember, $\sqrt{a}$ is defined as the positive solution to the equation $x^2=a$, and the positive solution to $x^2=a^2$ is $|a|$.


After your edit

You aren't wrong, in fact, $$\sqrt{1-\sin(2x)}=\sqrt{(\sin x - \cos x)^2}=\sqrt{(\cos x - \sin x)^2}$$

But if you want to calculate the integral, then you will additionally have to change that into

$$|\sin x - \cos x|$$

(or, alternatively, into $|\cos x - \sin x|$ since it's the same thing) and separate some cases.

0
On

Hint: $$\left(\cos(x)-\sin(x)\right)^2=\sqrt{2}^2\cos^2\left(x+\frac{\pi}{4}\right)$$