Wednesday, May 25, 2016

Absolute Value: Does |x|^2 = x^2?

Absolute Value:  Does |x|^2 = x^2?

Proof that |x|^2 = x^2, assuming x is a real number.

Note that |x| = x/sgn(x), where sgn(x) is the sign function where:

sgn(x) = -1 if x < 0,
sgn(x) = 0 if x = 0,
and sgn(x) = 1 if x > 0

Case: x = 0. 

Then:
|0| = 0 and |0|^2 = 0^2 = 0.

Case: x ≠ 0.  

Then:
|x|^2 = (x/sgn(x))^2
= x/sgn(x) * x/sgn(x)
= x^2/sgn(x)^2

If x < 0, sgn(x) = -1, and since -1 * -1 = 1, sgn(x)^2 = 1
If x > 0, sgn(x) = 1, and since 1 * 1 = 1, sgn(x)^2 = 1

Hence:
x^2/sgn(x)^2
= x^2

QED

Caution:  The statement |x|^2 = x^2 is not true for complex numbers where the imaginary part is nonzero. 

Let x = a + b*i

|x|^2 = |a + b*i|^2 = (√(a^2 + b^2))^2 = a^2 + b^2

x^2 = (a + b*i)^2 = a^2 + 2*a*b*i – b^2 ≠ a^2 + b^2   (b ≠ 0)


Conclude:  |x|^2 = x^2 only if x is a real number.


Eddie


This blog is property of Edward Shore, 2016

No comments:

Post a Comment

Adventures in Python: Plotting Sine and Cosine, The numpy Module

Adventures in Python:  Plotting Sine and Cosine, The numpy Module This program will require that you have both numpy and matplotlib.  ...