3

i'm trying to write this equation but LateX give me these errors. I already find similar question but any of them can solve the problem. Any suggestions?

\begin{equation}
\rho(X,Y) = {{{E(XY) - E(X)-E(Y)}\over{\sqrt{var(X)var(Y)}}}
\end{equation}

Thanks in advance!

2

There is a missing } at the end of the equation. Or rather, a couple of extra {. You could simplify the input to:

\begin{equation}
\rho(X,Y) = {E(XY) - E(X)-E(Y) \over \sqrt{var(X)var(Y)}}
\end{equation}

because the syntax for \over is {<subformula> \over <subformula>}, without the need of extra braces around the <subformula>s.

With proper LaTeX syntax and dedicated operators for E and var:

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\E}{E}
\DeclareMathOperator{\var}{var}
\begin{document}
\begin{equation}
\rho(X,Y) = \frac{\E(XY)-\E(X)-\E(Y)}{\sqrt{\var(X)\var(Y)}}
\end{equation}
\end{document}

enter image description here

  • thank you very much @Phelype! really clear explanation!! – Elisa m May 8 at 14:19
  • 1
    @Elisam You're welcome. Glad it helped :-) – Phelype Oleinik May 8 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.