Projection
The component of a vector a that is in the same direction as of vector b (Hence projection is a vector) Length of the projection does not depend on the length(magnitude) of b. See the image below
Projection has two parts:
(i) The direction where you're projecting onto. That's the unit vector in direction of b, which is computed by dividing b by the length of b. That is $$\frac{b}{||b||}$$
(ii) The component of a
in the direction of b. That is, the "shadow" or image of a when you project it onto b. This is computed by $$\frac{a⋅b}{||b||}$$ . because a⋅b=||a|| ||b|| cos(θ). Hence
||a||cos(θ)= $\frac{a⋅b}{||b||}$
and that gives you (as in the triangle figure), the length of a's projection on the direction of b
Putting it together, the projection of a onto b is a vector of length $$\frac{a⋅b}{||b||}$$
in the direction of $\frac{b}{||b||}$, i.e.
$$\frac{a.b}{||b||} \frac{b}{||b||} $$
Dot Product
It's simply the projection of one vector onto the other multiplied by the magnitude of other vector. The dot product tells you what amount of one vector goes in the direction of another (Thus its a scalar ) and hence do not have any direction .
a.b= ||a|| ||b|| cos(θ). Alternatively if a=(x1,y1) and b=(x2,y2) (Position vectors) the dot product is x1.x2+y1.y2 .