# Math formatting "Pro Tips" edition: Definition by cases! - "?"

Apr 30, 2015

I've (finally) found a way to write definitions by cases for functions.

The syntax looks like this

hashtag { (expression 1, "case 1"), (expression 2, "case 2"), (expression 3, "case 3") ... (expression n, "case n") :} hashtag

Here's an example

• Without the hashtags

f(x) = { (x^2, ", if x is even"), (2x + 1, ", if x is odd") :}

• With the hashtags

$f \left(x\right) = \left\{\begin{matrix}{x}^{2} & \text{ & if x is even" \\ 2x + 1 & " & if x is odd}\end{matrix}\right.$

Aparently, if you use $\text{:}}$ at the end of the syntax, the second bracket will no longer be visible.

However, if you want the first bracket removed, but still keep this format, you'll have to write $\text{{:}$ for the first bracket and $\text{:}}}$ for the second

• Without the hashtags

{: ("if x is > 0, ", x^2), ("if x is < 0, ", 2x+1) :}} = f(x)

• With the hashtags

{: ("if x is > 0, ", x^2), ("if x is < 0, ", 2x+1) :}} = f(x)

This could also be used for absolute values equations and stuff like that

• Without the hashtags

|x + 2| = { (x +2, ", if x + 2" >= "0"), (-x-2, ", if x + 2 < 0") :}

• With the hashtags

$| x + 2 | = \left\{\begin{matrix}x + 2 & \text{ & if x + 2" >= "0" \\ -x-2 & " & if x + 2 < 0}\end{matrix}\right.$

Jun 18, 2015

This is just a practice answer.

#### Explanation:

So, the synthax for writing matrices looks iooks like this

• Without the hashtags

( (1,1,1), (2,2,2), (3,3,3) )

• With the hashtags

$\left(\begin{matrix}1 & 1 & 1 \\ 2 & 2 & 2 \\ 3 & 3 & 3\end{matrix}\right)$

Basically, you group the rows by using parantheses and you write them one after the other. Check out more examples of matrices here:

http://socratic.org/questions/how-to-write-matrices-on-socratic141468

For piecewise functions, you can write

• Without the hashtags

{ (2x+2, ", x">="0"), (x^2, ", x<0") :}

• With the hashtags

$\left\{\begin{matrix}2 x + 2 & \text{ & x">="0" \\ x^2 & " & x<0}\end{matrix}\right.$

The trick here is to write { as the first bracket and :}# as the end bracket. Once again, the rows are grouped with paratheses. Check out more examples here: