Applying a function to both sides of equation

How can I be sure if I can apply a function to both sides of an equation and preserve equality?
for example:
x = y ⇔ x2 = y2
or
x = y ⇔ $\sqrt{}x$ = $\sqrt{}y$
or
x < y ⇔ log(x) < log(y)

What's up with that?

 Recognitions: Homework Help Science Advisor You can alays apply the same operation to both sides of an equation (in the modern sense of indicating equality). If they're equal to start with and you do the same to both sides then they must still be equal. But that does not work for inequalities. If you apply a monotonically decreasing function to each side (negation, inversion of items having the same sign) you must reverse the inequality. If the function is not even monotone then all bets are off.
 Recognitions: Science Advisor Not always: Example: (-1)2 = 12, but -1 ≠ 1.

Applying a function to both sides of equation

 Quote by mathman Not always: Example: (-1)2 = 12, but -1 ≠ 1.
Exactly

 Blog Entries: 9 Recognitions: Homework Help Science Advisor Mathematically speaking, the function must be injective, in case of equalities.

Recognitions:
Homework Help
 Quote by mr0no How can I be sure if I can apply a function to both sides of an equation and preserve equality? for example: x = y ⇔ x2 = y2 or x = y ⇔ $\sqrt{}x$ = $\sqrt{}y$
The implication is only guaranteed to be one way. If x = y, then you can safely "apply a function to both sides" because you know x = y. That is, let z = f(x). But, since we know x = y, we can replace x with y in this equation, so z = f(y). The result z is the same in both cases, so we know f(x) = f(y).

However, given f(x) = f(y), you cannot necessarily conclude x = y, because the function f may not have a unique inverse. For examples, x2 = y2 does not imply x = y, because it is possible that x = -y. However, this doesn't contradict what I said about because taking the square root function of both sides does not give you "x = y". If you apply the square root function to both sides, what you actually get is |x| = |y|, which is true, because ##\sqrt{a^2} = |a|## for any real number a.

 or x < y ⇔ log(x) < log(y) What's up with that?
The case is of inequalities is trickier and a different situation. If x < y, then you can only conclude f(x) < f(y) if f is a monotonically increasing function only the region that contains x and y. That is, if f'(x) > 0 on the entire region containing x and y.

For example, consider 0<x<y and f(t) = exp(t). Since exp(t) is always increasing, we can conclude exp(x) < exp(y). However, consider a function g(t) = exp(-t). This function is always decreasing, so x < y actually implies g(x) > g(y).

For a trickier example, let h(t) = sin(t), and let ##0 < x < y < \pi/2##. The sine function is monotonically increasing on this interval, so we can conclude that sin(x) < sin(y). However, if it were the case that 0 < x < y, but ##y > \pi/2##, then we cannot conclude that sin(x) < sin(y) because it may not be true, as sin(t) is decreasing on ##\pi/2<t<3\pi/2##.

Recognitions:
Homework Help
 Quote by mathman Not always: Example: (-1)2 = 12, but -1 ≠ 1.
What operation are you applying to both sides of what initial equation?
If you're starting with (-1)2 = 12 and square-rooting you get √((-1)2) = √(12). It is not valid to reduce that to -1 = 1. You can make it 1 = 1, or ±1 = ±1.

Recognitions:
 Quote by haruspex What operation are you applying to both sides of what initial equation? If you're starting with (-1)2 = 12 and square-rooting you get √((-1)2) = √(12). It is not valid to reduce that to -1 = 1. You can make it 1 = 1, or ±1 = ±1.
The first item on the list is x = y is equivalent to x2 = y2. This not necessarily true.

Recognitions:
Homework Help
 Quote by mathman The first item on the list is x = y is equivalent to x2 = y2. This not necessarily true.
Allow me to rephrase my original post without changing its burden:
Square rooting is a defined function. It can be applied to both sides of an equation with confidence. Going from x2 to x is not a defined function. The square root of x2 is ±x, and √(x2) is defined to be |x|.

 Quote by haruspex Allow me to rephrase my original post without changing its burden: Square rooting is a defined function. It can be applied to both sides of an equation with confidence. Going from x2 to x is not a defined function. The square root of x2 is ±x, and √(x2) is defined to be |x|.
It's a bit more subtle than that. The square root function has domain ##[0,\infty)## and range ##[0,\infty)##. Going from x2 to x is always fine provided you stay with this domain. If x is outside of this, you now have problems, and it is no longer a function.

The phrase "the square root" is reserved for the principle branch, which in the case of reals is always positive. The radical symbol, √, is also reserved for this. This is why the quadratic formula has a ±.

Lastly, and this is a minor technicality, √(x2) is not "defined" as |x|. The former is defined by the composition of two functions. The latter has it's own (piecewise) definition. These two function just happen to be equal to each other pointwise. But you shouldn't say one is "defined" in terms of the other.

I know what you are trying to say, you just need to be a bit more precise in your vocab choice.

Recognitions:
Homework Help
 Quote by pwsnafu The square root function has domain [0,∞) and range [0,∞). Going from x2 to x is always fine provided you stay with this domain.
The problem is not that x2 was outside that domain, but that x was outside that range.
 √(x2) is not "defined" as |x|.
OK, but it is defined in such a way that the two are equivalent, and this is pretty much what you are saying wrt range.
Everyone else responding on this thread appears to think that "going from x2 to x" is a legitimate algebraic manoeuvre, but which is an exception to the rule that you can freely apply the same function to both sides of an equation. My point is that it is not an algebraic operation at all, it is a lexical one, and there cannot be exceptions to the rule.

 Quote by haruspex The problem is not that x2 was outside that domain, but that x was outside that range.
Correct.

 OK, but it is defined in such a way that the two are equivalent, and this is pretty much what you are saying wrt range.
Again correct.

 Everyone else responding on this thread appears to think that "going from x2 to x" is a legitimate algebraic manoeuvre, but which is an exception to the rule that you can freely apply the same function to both sides of an equation. My point is that it is not an algebraic operation at all, it is a lexical one, and there cannot be exceptions to the rule.
What do you mean by "lexical" operation?

 Quote by haruspex Allow me to rephrase my original post without changing its burden: Square rooting is a defined function. It can be applied to both sides of an equation with confidence. Going from x2 to x is not a defined function. The square root of x2 is ±x, and √(x2) is defined to be |x|.
The fact remains that mathman was correct. He was objecting to the statement that x2=y2 implies that x=y.

Recognitions:
Homework Help
 Quote by oay The fact remains that mathman was correct. He was objecting to the statement that x2=y2 implies that x=y.
I never said it did.

Recognitions:
Homework Help
 Quote by pwsnafu What do you mean by "lexical" operation?
A manipulation of the symbols; in this case, removing the exponent.

Recognitions:
Homework Help
 Quote by haruspex I never said it did.
No, the OP said it did [saying x2 = y2 and x=y are equivalent]. mathman's post that you responded to was merely give a concrete example to demonstrate a case for which x2 = y2 but x = y, demonstrating that the equivalence the OP posited was false. mathman did not claim he was applying any functional (or even lexical) operation to both sides of the equation, it was just an example to demonstrate the falsity of the OP's claim.

Mentor
 Quote by haruspex Allow me to rephrase my original post without changing its burden: Square rooting is a defined function. It can be applied to both sides of an equation with confidence. Going from x2 to x is not a defined function. The square root of x2 is ±x,
No.
This is an extremely common misconception that comes up here way too often. Would you say that ##\sqrt{2^2} = \pm 2##? Although it is true that 4 has two square roots, the expression ##\sqrt{4}## denotes the principal square root, or 2.
 Quote by haruspex and √(x2) is defined to be |x|.
Right, and this too has a single value.