When using the multiline environment with the following code
1. \(E(Y ) = aE(X) + b\). (5 marks)\par
\begin{multiline}
\begin{equation}
\E(aX+b)&=& \sum_{x}{ax+b)p(x)\\
\sum_{X}(ax\cdot p(x)+b\cdot p(x))\\
\sum_{X}ax\cdot p(x) + \sum_{X}b\cdot p(x)\\
a\underbrace{\left(\sum_{X}X\cdot p(x)\right)}_{E(X)} + b\underbrace{\left(\sum_{X}p(x)\right)}_{1}\\
a\cdot \E(X) + b}
\end{equation}
\end{multiline}
The equation goes over the width of the pagw, as seen in the screenshot below
I have tried to use the align environment, but it gives me an error saying that the environment cannot be recognised.
Can you help me to resolve this?
equation
insidemultiline?
do not useequation
(or\par
) and use\\
where you want the liebreaksto occur\documentclass
to\end{document}
and show the exact error message from the log file.equation
is always one line