dot product can be defined like this.
The dot product a · b is equal to the signed length of the projection of b onto any line parallel to a, multiplied by the length of a.
a.b = (length of projection of b on a) * |a|
How is projection related with dot product ?. And any proof for this formula.
The orthogonal projection of $b$ onto the line generated by $a$ is a vector $ra$. such that $b-ra$ is orthogonal to $a$. Then $0=(b-ra)\cdot a=b\cdot a-r(a\cdot a)$.
Therefore $a\cdot b=r\|a\|^2$. Since the projection is $ra$, its length is $\|ra\|=|r|\|a\|$.
So, $b\cdot a=r\|a\|\|a\|=sign(r)\|ra\|\|a\|$.
In your formula I guess you need to interpret "legnth of the projection" as "signed length of the projection", which is the $r\|a\|$.
For example, if $a=(1,0)$, then the projections of $b_1=(1,1)$ and $b_2=(-1,1)$ onto the line generated by $a$, which is the $x$-axis, have the same length. But $a\cdot b_1=1$, while $a\cdot b_2=-1$.