A vector has length 4 and orientation 150o. Express the vector as a column vector.

A good answer might be:

The 2D vector is ( -3.464, 2.0 )


The steps in this calculation are:

  1. Draw a sketch: see diagram
  2. Calculate x by projecting the length onto the x-axis:
    4 * cos( 150 ) = -3.464
  3. Calculate y by projecting the length onto the y-axis:
    4 * sin( 150 ) = 2.0
  4. Check answers against the sketch: Looks OK.

Be cautious about plugging into these formulae and expecting correct answers, especially when programming in C or Java. Math libraries for a programming language can do unexpected things if you are not careful.

There are three places to be especially cautious:

  1. The argument for sin(), cos(), tan() is expected in radians. The return value of atan() is in radians.
  2. The argument for most math functions is expected to be a double. In "C", if you supply a float or an int, you won't get a error message, just a horribly incorrect answer.
  3. There are several versions of "arc tan" in most C libraries, each for a different range of output vaues.

Now would be a good time think about radians. Usually in professional circles, angles are expressed in radians. Angles are measured counterclockwise from the positive x axis (or sometimes a negative angle is measured clockwise from the positive x axis.

There are 2 pi radians per full circle. Or 2 pi radians = 360o


Fill in the blanks so that vector[0] gets the x component and vector[1] gets the y component of the vector.

#include <math.h>
#define PI 3.14159265

double length, angle;
double vector[2];

 . . .
length = some value
angle  = some number of degrees

vector[0] =  ________________

vector[1] =  ________________

(If you don't know C, just pretend this is Java.)