# Write Mathematical Equation

Im writing fraction in an equation. But then when I inserted $\frac{1}{2}$ inside the align*, error says missing }. I don't get it. Removing the code fraction will make my code work.

\begin{align*}

Q(i,j) &= (n-2)d(i,j) - \sum_{k=1}^{n} d(i,k) - \sum_{k=1}^{n} d(j,k)    \\  \newline

\delta (i,j) & =  $\frac{1}{2}$

\end{align*}

• you used an extra backslash right before \newline also, why did you pick \newline over \? – 1010011010 Oct 5 '14 at 23:44
• it has double backlash, i don't know why it don't appear. My real problem is why putting this $\frac{1}{2}$ brings error. – programmer Oct 5 '14 at 23:47

\begin{align*}

(of course, amsmath is called). Please observe that now there are no empty lines inside align* environment.
• one other thing you didn't point out explicitly, but is essential: tje aalign environment is already math mode, so \$ signs around the frac expression are not only not needed, they will result in an error message. – barbara beeton Oct 6 '14 at 16:29