I am taking the principal root of $\cos^2(x)$ so I thought it would be, but when you ask wolfram alpha it says it's only sometimes true, when $x > 0$ (see here). Can someone explain why this is to me and give a value of $x$ for which it is not true? I'm just an $11$th grader in trig, so I probably won't understand it if you make it too complex. Thanks. Sorry if the tag is off.
-
$\begingroup$ is $x$ a real number so we get $$\sqrt {x^2}=|x|$$ $\endgroup$– Dr. Sonnhard GraubnerNov 28, 2015 at 3:15
-
$\begingroup$ The WolframAlpha output says that $\sqrt{\cos^2(x)}=|\cos(x)|$ is always true assuming $x$ is a real number (which is the case if you're doing 11th grad trigonometry). $\endgroup$– kccuNov 28, 2015 at 3:18
-
$\begingroup$ If you force WA to assume only real $x$'s it simply returns $|\cos(x)|$ with no other restrictions on $x$. $\endgroup$– got it--thanksNov 28, 2015 at 4:25
2 Answers
The statemnet $\sqrt{\cos^2(x)}=|\cos(x)|$ is true for all real $x$. Wolfram|Alpha, on the other hand, has the often annoying habit of considering all complex numbers by default. So, it's not willing to apply the identity $$\sqrt{x^2}=|x|$$ unless it knows that $x$ is real. Given that $\cos(x)$ is real for all real $x$, the identity you cite is true for any real $x$ - which is all you really need to worry about. Wolfram|Alpha even, a little bit down on the page in a section labelled "Real Solutions" writes $\operatorname{Im}(x)=0$ which says that if $x$ has no imaginary part (i.e. is a real number) then it satisfies the equation.
The main problem in the complex plane is that, although it is generally true that $\sqrt{x^2}=\pm x$ it's possible that (e.g. for $x=i$ where $i$ is the imaginary unit, $\sqrt{-1}$) neither $x$ nor $-x$ is a positive real, whereas $|x|$ is always a positive real. Thus, $\sqrt{x^2}=|x|$ is not true anywhere except on the real line, which means that nearly any complex number (in particular any number $a+bi$ where $b$ is not zero and $a$ is not a multiple of $\pi$) fails to satisfy the original identity with cosine.
(But really, if you're in a trigonometry class, don't worry about any of this. This has very little to do with trigonometry. The real moral of the story is possibly that Wolfram|Alpha can say things which are useless and confusing, albeit technically true)
You want to read the alternate form assuming $x$ is real. (The one about $x>0$ is a red herring, just written there in case that was what a user wanted to know about.) If $x$ is not real but rather complex then the square root is a more complicated animal (see https://en.wikipedia.org/wiki/Square_root for more info).