Proving an identity involving floor function

Prove that :

$$\left \lfloor \dfrac{2 a^2}{b} \right \rfloor - 2 \left \lfloor \dfrac{a^2}{b} \right \rfloor = \left \lfloor \dfrac{2 (a^2 \bmod b)}{b} \right \rfloor$$

Where $$a$$ and $$b$$ are positive integers.

Let us assume that $b>0$. By division algorithm $a^2=bq+r$ with $0 \leq r <b$. Then \begin{align*} a^2&=bq+r\\ \frac{2a^2}{b} & =2q+\frac{2r}{b}\\ \left\lfloor \frac{2a^2}{b} \right\rfloor & = 2q+\left\lfloor \frac{2r}{b} \right\rfloor\\ \left\lfloor \frac{2a^2}{b} \right\rfloor -2q& =\left\lfloor \frac{2r}{b} \right\rfloor\\ \left\lfloor \frac{2a^2}{b} \right\rfloor -2\left\lfloor \frac{a^2}{b} \right\rfloor& =\left\lfloor \frac{2(a^2 \bmod b)}{b} \right\rfloor\\ \end{align*}