[Tex/LaTex] Writing this function on moodle using TeX Notation


I want to write an equation with one curly brace ({) on the right hand side and, next to the curly, two statements in two different lines. How can i do it using TeX or Latex? Thanks.enter image description here

Best Answer

I don't know about Noodle but, using the amsmath package you can simply use

f(x) = 
 (x+2)^{2}\,, & x<-2 \\
 4-x^{2}\,, & x\ge -2