Calculating angle and direction between two vectors

Standard

 

Normally, if we were to find the angle between two vectors, say up-vector and dir-vector, what we would do is to do a dot product between them. Since

a \cdot b = |a||b| \cos{\theta} and

\cos{\theta} = \frac{a \cdot b}{|a||b|}

dot_product_01However, since the calculated angle is the smallest / nearest angle between the two vectors, we can’t derive the (rotational) direction of one vector from the other. Thus in the following figure, it’s hard to figure out whether the direction vector is on the left or right of the up vector. The angle between two vectors calculated using dot product is always between 0° to 180°, thus we are not able to derive the direction from it. Continue reading

Checking divisibility of a number

Standard

The ability to check whether a number is divisible by, say 4 or 9, seems to be useless at first.

But it could be a time saver when you’re trying to check the result of your calculation without resorting to the help of a calculator. Or it could be an amusing mental trick (or what Arthur Benjamin called Mathemagic) which you can use it for fun while drinking some beers in the pub.

Continue reading