When can I swap the terms inside a square of a difference?

72 Views Asked by At

Introduction

Suppose I have the expression $\sqrt{(a-b)^2}$. There is no restriction on the nature of $a$ and $b$. Now what is the value of this expression?

Is it $a-b$? But I can also write it as $\sqrt{(-1)^2(a-b)^2}$ or $b-a$. I guess it's fair because we have a quadratic involved, which leads to two roots.

But suppose we have that expression as a part of another larger expression. And there is only one answer given. If I put one of these final expressions, I get the correct answer, but I get a different answer entirely when I put the other expression.


Where I encountered this problem

In my book, there is an example problem (with solution):

$\int\sqrt{1- \sin{2x}}dx$

I simplified the expression (before Integration) to $(\sin x - \cos x)$ where as they simplified it to $(\cos x - \sin x)$. After Integration, I got $-\cos x -\sin x + C$ and they got $\sin x + \cos x + C$. I have differentiated both these expressions and they both yield the original expression.

So my question is, what do I do when I encounter such questions and only one answer is accepted? And also when is it safe to swap the terms is such cases?

2

There are 2 best solutions below

2
On

The notation $\sqrt{x}$ denotes the principal square root, or the positive value of the square root. So, $\sqrt{(a-b)^2}=\left|{a-b}\right|$.

So $\sqrt{1-\sin{2x}}=\left|\sin{x}-\cos{x}\right|$. At $x=0$, $\cos{x}-\sin{x}$ is the positive one, which is why I guess your book wrote that one, but unless there were bounds of integration you should really integrate $\left|\sin{x}-\cos{x}\right|$.

0
On

You have to remember that $\sqrt{x^2}=|x|$, and so since $1-\sin(2x)=1-2\sin(x)\cos(x)=(\sin(x)-\cos(x))^2$, what you have is

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

Without more information, this integral cannot be computed further more as we don't know wich of $\sin$ or $\cos$ is bigger, so we can't treat the absolute value. If a range to integrate was given, you could split it up into (possibly 1) many integrals and get either $\sin(x)-\cos(x)$ or $\cos(x)-\sin(x)$.