From the formula for dot product of vectors can derivative the formula for cosine of angle between vectors. cosα = a⋅b / |a||b|. a⋅b - dot product of vectors "a" and "b". |a|, |b| - magnitude of vectors a and b. Examples. a = [4,3], b = [2,5]. a⋅b = [4,3]⋅[2,5] = 4*2 + 3*5 = 23. Function cos equals 0 for α = 90°. Vector a is at right angle to vector b.