The LU-factorisation of $A\in\mathbb{R}^{n\times n}$ is given by $$A=LU,$$ where $L$ is a unit lower triangular matrix and $U$ is an upper triangular matrix.
I am trying to understand why it takes $2n^2$ floating-point operations to compute both $Ly=b$ and $Ux=y$.
Here we define a floating-point operation (flop) to be an operation, i.e. $a+b$ or $ab$, of two floating-point numbers $a$ and $b$.
Take $Ly=b$. The $k$th row is solved using $y_k = {1 \over L_{kk}} (b_k -(L_{k1}y_1+\cdots+ L_{k,k-1}\ y_{k-1}))$. This takes $k-1$ multiplications, one division, $k-2$ additions and one subtraction which is $2k-1$ flops. Now sum of all rows to get $\sum_{k=1}^n (2k-1) = n^2$.
The $Ux=y$ is basically the same, hence the $2n^2$.