Vector Math for Raytracer So i am working through the book "Raytracing in one weekend".
At the point where i am at we want to check if a ray hits a sphere.
For that we have the equation:

dot((A + t*B - C),(A + t*B - C)) = R*R


Where A + t*B is a point on the ray, with A the start, B the direction and t how far along we went on the ray.

To solve this the author transformed the equation to:

t*t*dot(B,B) + 2*t*dot(A-C,A-C) + dot(C,C) - R*R = 0


Now i just can not understand how this transformation comes about. 
Simply multiplying this out seems to give a way different result.

Is there some kind of vector math i'm missing here?
I think there might be a misprinting in the book. I am getting this

$((A-C) + tB)\cdot((A-C) + tB) = R\cdot R$ 

Let  A-C = Y

$(Y + tB)\cdot(Y + tB) = R\cdot R$

$Y\cdot Y + Y\cdot tB + tB\cdot Y + t^2B\cdot B = R\cdot R$

Substituting back 

$(A-C)\cdot(A-C) + 2t * B\cdot(A-C) + t^2B\cdot B = R\cdot R$