## How do you write a function in Latex that is defined differently on multiple sections

I am going to show how to write the following function in LaTeX

$f(x) = \left\{ \begin{array}{ll} e^{-1/x^{2}}, & x \neq 0,\\ 0, & x=0. \end{array} \right.$

We can write this function a little nicer (according to me), we will shorten the gap between the opening curly brace and the beginning of function definitions (we will use the gap space that LaTeX uses between for example a+b – defined in this case as @{\>}, which is a little bit smaller gap that a=b – which would be defined with @{\;}. We will also use a bigger gap between the function definitions and sections, by using \quad spacing – defined in this case with @{\quad}.

$f(x) = \left\{ \begin{array}{@{\>}l@{\quad}l} e^{-1/x^{2}}, & x \neq 0,\\ 0, & x=0. \end{array} \right.$

We can see the difference between spaces in the picture below.