All equations fit in a single line, but the 3rd line (equation) is too long, so I need to divided it into 2 lines. I have tried \\ but it doesn't work. This is what I have (I added more space in between so you can see the 3rd equation):
\begin{eqnarray}
&I&= \displaystyle \int_{x_0=0}^{x_2=2h} \left[ \left(\dfrac{x^2-3hx+2h^2}{2h^2}\right)f(x_0) + \left(\dfrac{4hx-2x^2}{2h^2}\right)f(x_1) + \left(\dfrac{x^2-hx}{2h^2}\right)f(x_2)\right] \ dx \nonumber\
&=& \dfrac{1}{2h^2}\left[ \left(\dfrac{x^3}{3}-\dfrac{3hx^2}{2}+2h^2x\right)f(x_0) + \left(\dfrac{4hx^2}{2}-\dfrac{2x^3}{3}\right)f(x_1) + \left(\dfrac{x^3}{3}-\dfrac{hx^2}{2}\right)f(x_2)\right]_0^{2h} \nonumber\
&=& \dfrac{1}{2h^2}\left[ \left(\dfrac{(2h)^3}{3}-\dfrac{3h(2h)^2}{2}+2h^2(2h)\right)f(x_0) + \left(\dfrac{4h(2h)^2}{2}-\dfrac{2(2h)^3}{3}\right)f(x_1) +\left(\dfrac{(2h)^3}{3}-\dfrac{h(2h)^2}{2}\right)f(x_2) + 0\right] \nonumber\
&=&\dfrac{1}{2h^2}\left[ \left(\dfrac{8h^3}{3}-6h^3+4h^3\right)f(x_0) + \left(8h^3-\dfrac{16h^3}{3}\right)f(x_1) + \left(\dfrac{8h^3}{3}-2h^3\right)f(x_2) \right]\nonumber \
&=&\dfrac{1}{2h^2}\left[ \left(\dfrac{2h^3}{3}\right)f(x_0) + \left(\dfrac{8h^3}{3}\right)f(x_1) + \left(\dfrac{2h^3}{3}\right)f(x_2) \right] \nonumber\
&=&\dfrac{1}{2h^2}\cdot \dfrac{2h^3}{3}\left[ f(x_0) + 4f(x_1) + f(x_2) \right] \nonumber\
&=&\dfrac{h}{3}\left[ f(x_0) + 4f(x_1) + f(x_2) \right] \
\end{eqnarray}


eqnarray, it often gives inconsistent spacing. Instead, you should usealignfromamsmath. – Skillmon Dec 04 '20 at 15:57