9
$\begingroup$

Context

Norm[{1, Sin[t], Cos[t]}]
Norm[{1, Sin[t], Cos[t]}] // Simplify
(*
Sqrt[1 + Abs[Cos[t]]^2 + Abs[Sin[t]]^2]    
Sqrt[1 + Abs[Cos[t]]^2 + Abs[Sin[t]]^2]
*)

Question:

How do I coax Mathematica to output Sqrt[2]?

$\endgroup$

2 Answers 2

17
$\begingroup$
Simplify[Norm[{1, Sin[t], Cos[t]}], Element[t, Reals]]
(*
 Sqrt[2]
*)

Because

Plot3D[Norm[{1, Sin[a + b I], Cos[a + b I]}], {a, -1, 1}, {b, -1, 1}]

enter image description here

$\endgroup$
3
  • 3
    $\begingroup$ so basically, the problem is that Mathematica is smarter than me, and I was not aware that cos^2 x + sin^2 x = 1 only for real x ? $\endgroup$
    – user1602
    Commented Jul 11, 2012 at 3:39
  • 3
    $\begingroup$ @term-rewritica: no, you are right $\cos^2 x + \sin^2 x$ is always 1. However $|\cos x|^2+ | \sin x|^2$ is not always equal to 1. $\endgroup$
    – Fabian
    Commented Jul 11, 2012 at 16:41
  • $\begingroup$ @belisarius Wow, this was elegantly done! $\endgroup$
    – dearN
    Commented Oct 13, 2012 at 18:16
11
$\begingroup$

Just so that all the i's are dotted and t's crossed:

$$\cos^2(z)+\sin^2(z)=1$$ for all complex $z$ (since $\cos^2(z)+\sin^2(z)-1$ is a holomorphic function that vanishes on the real axis, it vanishes everywhere); but $$|\cos(z)|^2+|\sin(z)|^2 \neq 1$$ in general unless $z$ is real.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.