Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've looked but cannot find the mathematical way to represent the following:

r = Max(x1, x2, x3)

I want to mathematically show that r = max value of the set (x1, x2, x3). To make sure I'm being clear, I want to write the math formula of the code equivalent.

share|cite|improve this question
Yes, Virginia, this is related. – J. M. Dec 19 '10 at 13:34
possible duplicate of Nice expression for minimum of three variables? – Jonas Meyer Dec 19 '10 at 18:24
up vote 2 down vote accepted

As I responded on stackoverflow...

You can take the infinity/uniform norm of the corresponding tuple, which is defined as

$$\lim_{n \rightarrow \infty} (|x_1|^n + |x_2|^n + |x_3|^n + ...)^{\frac{1}{n}}$$

Or you can just have a maximum/infimum function... what exactly is your problem with using that?

Alternatively, you can define $f\mbox{ = max}$ recursively as

$$f(\{a_1,a_2,a_3,\cdots\}) = \begin{cases} a_1 & \mbox{if the sequence is singleton} \\ f(\{a_2,a_3,a_4,\cdots\}) & \mbox{if } a_1 \leq a_2 \\ f(\{a_1,a_3,a_4,\cdots\}) & \mbox{otherwise} \end{cases}$$

This can be made a lot nicer if you allow $f$ to be a two variable function with an accumulator.

share|cite|improve this answer
Yeah, the max function is perfectly legitimate. One can also use: $\max(a,b)=\frac{1}{2}(a+b+|a-b|)$. – Raskolnikov Dec 19 '10 at 13:32
I have no issue with the function. I just want to know how to write it correctly as a math formula. Average, sum, etc. is easy. But how do we say max? Do we write the word "max"? – IamIC Dec 19 '10 at 13:34
Just writing 'max' is fine. Also of note is the supremum, which is the least upper bound of the sequence (this can be different from maximum if the sequence is infinite... consider the sequence {1-1/n}, which has no maximum but a least upper bound of 1). – Yonatan N Dec 19 '10 at 13:39

I wouldn't write $\max(a,b)$ or $\max(a,b,c)$. For me, max assigns to a set its maximal element (if it exists), so I use $\max\{a,b\}$ and $\max\{a,b,c\}$. In general, if $A$ is a set of real numbers, I write $\max A := \sup A$ (the supremum of $A$) if $\sup A$ is an element of $A$.

share|cite|improve this answer
+1 spot-on re. the {}. Thanks. – IamIC Dec 19 '10 at 22:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.