Basic Properties of Numbers #3

Brief explanation: This is yet another problem with absolute value: but this time, an important one. I really enjoyed this one not because of it’s math but because of it’s relation with programming. You’ll see what I mean!

(Another exercise taken from Michael Spivak’s Calculus)

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Question: The maximum of two numbers x and y is denoted by max(x,y). Thus, max(-1,3) = max(3,3) = 3 and max(-1,-4) = max(-4,-1) = -1. Prove that:

enunciado.png

And derive a formula for max(x,y,z).

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Comprehending:

This is not a  complex problem to solve but one that shows how deep Mathematics goes. First of all, how to we prove the formula is correct? Let’s take an example to see how it works:

exemplo.png

Proving the formula is correct is just showing it works on a general case. This means comprehending all possible cases and proving the formula works for them.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Solving:

The formula allows us to see that there will be two different situations: when x > y and when y > x. These two situations are created because of the expression inside the absolute value bars, and we’ll have to evaluate both of them in order to prove how the formula works. First, when x > y:
 1
This means y-x will be negative. Hence, the expression |y-x|:
 2.png
Applying this to the original formula we get:
 3.png
So the formula worked! Remember for this instance we chose x > y.
Now, for the case y > x we do it all again:
 4.png
So y-x will be positive. The expression inside the absolute value bars will be:
 5.png
Applying to the original formula:
6.png
Again, the formula worked! This proves that in all cases possible (y > x and x > y) the formula works.
Now, for the second part of the problem, we derive a formula for the maximum of three variables (max(x,y,z)).
The trick in this part is to think: if we have a list of numbers, how can we evaluate the maximum of all the numbers? The way I would do it is the following: go through the list and register the maximum value I see. Whenever a number is greater than the one I regitered before, I cross the previous number and register the new one. And that is just the exact process we have to do here!
Lets think for a bit about the process I described. What are we actually doing? In the end, we are reducing the list to just two numbers, the biggest one we described so far, and the next one on the list. We are actually applying the formula to a smaller list and iterating on the bigger list. This just means that:
 7.png
If you’re having problems understanding why this is, try it yourself! Get a list of numbers and apply this algorithm, and you’ll se how it works.
Now, all we need to do is to apply this to the formula we were given. We’ll have a formula inside itself, because we first calculate the maximum between y and z. This is given by:
 8.png
We are now able to derive the bigger formula. Applying this to our previous thought:
 9.png
And we’re done! This ‘inception’ would go on if we added more variables: sometimes expressing things mathematically is quite hard, even for simple processes like this.
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
Taking it further:
(1) Can you figure out the formula for min(x,y) and min(x,y,z)? It’s not so different from the ones we saw here!
(2) This kind of ‘inception’ is called a recursive function. I am currently trying to develop a program in Python using a recursive function to calculate the maximum value of a given list. I’ll post it here when I’m done!
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s