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 am looking for a function that has this meaning:

f(x)= if x>10 x+1 else x-1


f(x)=x>10 : x+1 ? x-1

Similar to the ternary operator in computer programming. What syntax should I use to express this as a mathematical function?

share|cite|improve this question
up vote 2 down vote accepted

$\forall x [(x>10 \rightarrow f(x) = (x + 1))] \land \forall x[(x\leq 10 \rightarrow f(x) = x-1)]$

I saw the "logic" tag, and assumed you wanted a means to express this in logic.

Essentially, there are two cases: $$f(x)=\begin{cases}x+1 &\text{ if}\; x>10\\ \\ x-1 &\text{ if}\; x\leq10\end{cases}$$

This is a perfectly legitimate mathematical function, known as a Piecewise Function.

share|cite|improve this answer
Nice reference too +1 – Amzoti May 8 '13 at 2:42

You could use the Iverson bracket, defined for a predicate $P$, as $$ [P] =\begin{cases} 1 & \text{if }P\text{ is true,}\\ 0 & \text{otherwise} \end{cases} $$ Then for your function you'd have $$ f(x)=x-1+2[x>10] $$ This notation comes from the programming language APL. The only downside to this notation is that a fair number of mathematicians haven't been exposed to it, so you'll have to explain it before you use it.

share|cite|improve this answer
That's assuming I'm a mathematician. – user1919496 Feb 4 '13 at 1:35
@user1919496 Actually, from your use of the compound conditional, I had assumed you were coming from the CS side. – Rick Decker Feb 4 '13 at 13:09

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.