# Why is this math equation showing errors?

Why does this code show errors?

For this equation I used the code:

$$Y_k\big(p+1\big) = \begin{cases} +1 \;\;\; if W_k > 0 \\ -1 \;\;\; if W_k < = 0 \end{cases}$$


The errors that appear are:

• Neverhave blank lines in equations. May 1 '19 at 22:00

There are several errors in your code.

1. There must be no blank line inside an equation environment.
2. You're already in math mode, so $>$ and $<$ are misplaced.
3. “if” should not be treated as math.
4. You're missing the alignment point.
5. <= should be \leq.

As a stylistic remark, there's no need for \big. If you really want it, it should be \bigl(p+1\bigr).

$$Y_k(p+1) = \begin{cases} +1 & \text{if } W_k > 0 \\ -1 & \text{if } W_k \leq 0 \end{cases}$$


• I would go for &\text{if $$W_k>0$$}\\..., but that's fine, too. May 1 '19 at 22:17
• @manooooh I too, but it's perhaps too advanced for the OP. May 1 '19 at 22:40