is the dot product of (a+b) . (a + b) = a^2 + b^2 + 2ab ?
That is more or less correct!
But it should be written as $\displaystyle \left( {a + b} \right) \cdot \left( {a + b} \right) = a \cdot a + 2a \cdot b + b \cdot b$.
Please note that the ‘dot products’ in the answer.
In fact here is an important form: $\displaystyle \left( {a + b} \right) \cdot \left( {a + b} \right) = \left\| a \right\|^2 + 2a \cdot b + \left\| b \right\|^2 $
No that is not correct!
To see where you went wrong, recall $\displaystyle v \cdot \left( {u + w} \right) = v \cdot u + v \cdot w$.
Let $\displaystyle v = \left( {a + b} \right)\;,\,u = a\;\& \,w = b$ and apply the distribution rule twice.