For the function listed below, try expressing them in a single formula.

Example :

\[ f(x) = \begin{cases} -x & \quad \text{if } x \geq 0\\ x & \quad \text{if } x<0\\ \end{cases} \]

Answer : \(f(x) = -|x|\)

Challenge 1 :

\[ f(x) = \begin{cases} 1 & \quad \text{if } x < 0\\ -1 & \quad \text{if } x>0\\ \end{cases} \]

Challenge 2 :

\[ f(x) = \begin{cases} 0 & \quad \text{if } x\leq 0\\ x & \quad \text{if } x>0\\ \end{cases} \]

Challenge 3 :

\[ f(x,y) = \begin{cases} x-y & \quad \text{if } x > y\\ x+y & \quad \text{if } x < y\\ \end{cases} \]

Comment your answer and vote up good functions!

## Comments

Sort by:

TopNewest1)\[-\dfrac{x}{|x|}\] 2)\[\left|\dfrac{x}{2}\right|+\dfrac{x}{2}\] 3)\[\dfrac{(x-y)(x+y)}{\left(x+\dfrac{|x-y|y}{x-y}\right)}\] – Aareyan Manzoor · 11 months, 1 week ago

Log in to reply

\(f_2(x)=\frac {|x|+x}{2}\)

We can find a solution by using the solutions for challenge 1 and 2:

I don't know how to type arrays so let \(1,2\) denote the conditions \(y-x<0, y-x>0\) respectively.

Note that \(f_2(y-x)+x=1.x, 2.y\) and \(f_2(y-x)-y=1.-y, 2.-x\).

Further, \(f_1(y-x)(f_2(y-x)-y)=1.-y, 2.x\)

Hence \(f(x)=f_2(y-x)+x+f_1(y-x)(f_2(y-x)-y)=1.x-y, 2.x+y\)

Another way is by considering \(\frac {1+f_1(y-x)}{2}=1.1, 2.0, \frac {1-f_1(y-x)}{2}=1.0, 2.1\).

Thus, \(f(x)=(x-y)\frac {1+f_1(y-x)}{2}+(x+y)\frac {1-f_1(y-x)}{2}\) – Xuming Liang · 11 months, 1 week ago

Log in to reply

For the first function, \(f(x) = 1_{\{x|x<0\}} - 1_{\{x|x>0\}}\) where \(f : \mathbb{R} \setminus \{0\} \to \mathbb{R}\). Because \(1_S\) is the characteristic function that returns \(1\) if the argument is in \(S\) and \(0\) otherwise.

If you want me to nitpick even more, those given aren't functions since you don't specify the domain (and the range, but the range usually can be inferred assuming it fits the whole domain). If I assume the domain of the first function is \(\{1\}\), then my "formula" can be as simple as \(f(x) = -1\) (because it only needs to work for the single number \(x = 1\) in the domain).

A more interesting question is why you want to look specifically for just a single formula, and not just leave the function piecewise which is much easier to understand compared to the single formula forms? – Ivan Koswara · 11 months, 1 week ago

Log in to reply

\[\sin 10^\circ \sin 30^\circ \sin 50^\circ \sin 70^\circ\]

without using a calculator.

Why shouldn't we use a calculator when we can? Isn't using a calculator faster and is less likely to have errors?– Christopher Boo · 11 months, 1 week agoLog in to reply

WolframAlpha anyway, though. – Ivan Koswara · 11 months, 1 week ago

You can't use calculator there because the result is rational. A calculator might round/truncate the result midway. I did throw it toLog in to reply

@Ivan Koswara, imagine you are solving a hard equation. yo just spend a huge time on it and are feeling proud of what you did! You want to show other people this cool eqn but when you show this to yor classmates, who suck at maths, say "waste of time, i solved it in a second by putting it in wolfram alpha. i am smarter then you."

But some stuff need analytical approach despite being easily solvable by numerical/computational approach. please think about this.

the "imagine" is taken from real life! – Aareyan Manzoor · 11 months, 1 week ago

Log in to reply