Writing a vector in component form given a magnitude and direction