I would like to align the equal signs in this block of equations. Somehow, the first equal sign is well aligned, but the second is not. Am I missing something obvious?

Thank you very much

\documentclass{article}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\begin{document}

\left\lbrace \begin{aligned} u_0 &=p_0 \\ u_1 &=p_0+p_1&=u_0+p_1 \\ u_2 &=p_0+p_1+p_2&=u_1+p_2 \\ \vdots \\ u_{n-1} &=p_0+p_1+\dots + p_{n-1} &= u_{n-2}+p_{n-1} \\ u_{n} &=p_0+p_1+\dots + p_{n} &= u_{n-1}+p_{n} \\ \end{aligned} \right.
\end{document}


Use alignedat. In contrast to aligned you have to specify the number of column pairs there, i.e. \begin{alignedat}{2}. Also ever third column is right aligned so you need to insert an empty column before your second equals as in &&=.
\documentclass{article}
\left\{ \begin{alignedat}{2} u_0 &=p_0 \\ u_1 &=p_0+p_1&&=u_0+p_1 \\ u_2 &=p_0+p_1+p_2&&=u_1+p_2 \\ \vdots \\ u_{n-1} &=p_0+p_1+\dots + p_{n-1} &&= u_{n-2}+p_{n-1} \\ u_{n} &=p_0+p_1+\dots + p_{n} &&= u_{n-1}+p_{n} \\ \end{alignedat} \right.