# New line in a math block [duplicate]

Possible Duplicate:
Linebreak in equations

I am very new to latex, its been a super frustrating I spend almost close to two hours on getting a new line inside the math block

${P(g(X) \neq Y |X = x) = 1 − P (Y = g(X)|X = x)} {= 1 - [P(Y=1,g(X)=1|X=x) + P(Y=1,g(X)=1|X=x)]} {= 1 − E[1_{Y =1} 1_{g(X)=1}|X = x] + E[1_{Y =0} 1{g(X)=0}|X = x]}$


Also I used underscores to show the subscript but somehow that doesn't work either.

It would be great if someone could give a pointer.

-

## marked as duplicate by Werner, Stefan Kottwitz♦Oct 6 '12 at 20:49

See here and or here –  Scott H. Oct 6 '12 at 17:03
What doesn't work with your subscript? Does it work when you use my code below? –  Juri Robl Oct 6 '12 at 17:13

Use a multiline environment from the amsmath package, like align:

\begin{align*}
\{P(g(X)\neq& Y \mid X=x) = 1-P(Y=g(X)\mid X=x)\}\\
\{=& 1 - [P(Y=1,g(X)=1\mid X=x)\\
&+ P(Y=1,g(X)=1\mid X=x)]\}\\
\{=& 1 - E\left[1_{Y =1} 1_{g(X)=1}\mid X = x\right]\\
&+ E\left[1_{Y =0} 1{g(X)=0}\mid X = x\right]\}
\end{align*}


If you don't want your equation numbered, use align* instead of align.

Instead of directly using the amsmath package, you can instead use mathtools. It tries to fix some bugs in amsmath and provides additional symbols and options to change the layout of equations.

-
+1 but this gives an overfull hbox; can you show the OP how to fix that, perhaps break the second line into two... –  cmhughes Oct 6 '12 at 16:59
And using \bigl(, \bigr) and \bigm| also improve the readability. –  Gonzalo Medina Oct 6 '12 at 17:03
those curly brackets I have those are not to seperate a block but I really want to add them in the equation how can i get that to work. –  find-missing-semicolon Oct 6 '12 at 17:22
Just escape them \{...\} –  Juri Robl Oct 6 '12 at 17:26
can you also tell me how to get rid of the equation number..? thanks bunch –  find-missing-semicolon Oct 6 '12 at 18:21