I'm doing my first steps in math proofs, therefore it seems a bit difficult to me to do them, so right now I have difficulties with the following:
Let's define the function $ \max(x, y) $ as follows: if $ x < y $, then $ \max(x, y) = y; $ else, $ \max(x, y) = x $. For example, $ \max(1, 3) = 3 $, $ \max(2, 2) = 2 $, and $ \max(-π, 137) = 137 $. Prove that the following holds for any $ x $, $ y $, and $ z $: $ \max(x, \max(y, z)) = \max(\max(x, y), z) $
What I have already tried. My first suggestion was to reach out to the definition of max, so that I can clarify what exactly the left side $ \max(x, \max(y, z)) $ means. The definition says that there are two cases to consider: when $ x < \max(x, y) $ and when $ x \geq \max(x, y) $. After this I got stuck, because the further assumptions seem branched (e.g. in the case $ x < \max(x, y)$ we want to consider two cases of the right side expression and etc).
Another approach I was thinking about is to consider all the possible cases (e.g. $ x \leq y \leq z $, then $ x \leq z \leq y $ etc) what seems odd and I guess there are more sophisticated ways to prove that (but I may be wrong).
Could you please give me any hints to problem which would lead me to more elegant proofs of this $ \max(x, \max(y, z)) = \max(\max(x, y), z) $ if there are any? By the way, is it important how you actually prove a theorem? Or is the result only important?
Your second idea for a proof is quite sensible, and it is what I would do. It's six cases, which is relatively large for a proof by cases, but each one is just a line long and your reader's eyes will glaze over after the second one anyways.