Skip to content Skip to navigation

Connexions

You are here: Home » Content » Linear Algebra: Direction Cosines

Navigation

Lenses

What is a lens?

Definition of a lens

Lenses

A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual Connexions member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

This content is ...

Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
  • Featured Content display tagshide tags

    This module is included inLens: Connexions Featured Content
    By: ConnexionsAs a part of collection:"A First Course in Electrical and Computer Engineering"

    Comments:

    "A First Course in Electrical and Computer Engineering provides readers with a comprehensive, introductory look at the world of electrical engineering. It was originally written by Louis Scharf […]"

    Click the "Featured Content" link to see all content affiliated with them.

    Click the tag icon tag icon to display tags associated with this content.

Recently Viewed

This feature requires Javascript to be enabled.

Tags

(What is a tag?)

These tags come from the endorsement, affiliation, and other lenses that include this content.

Linear Algebra: Direction Cosines

Module by: Louis Scharf. E-mail the author

User rating (How does the rating system work?)
Ratings

Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

How to rate a module

Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

:
(0 ratings)

Note: Your browser may not currently support MathML. See our browser support page for additional details. You can always view the correct math in the PDF version.

Note:

This module is part of the collection, A First Course in Electrical and Computer Engineering. The LaTeX source files for this collection were created using an optical character recognition technology, and because of this process there may be more errors than usual. Please contact us if you discover any errors.

Unit Vectors. Corresponding to every vector x x is a unit vector u x u x pointing in the same direction as x x. The term unit vector means that the norm of the vector is 1:

| | u x | | = 1 . | | u x | | = 1 . (1)

The question is, given x x, how can we find u x u x ? The first part of the answer is that u x u x will have to be a positive scalar multiple of x x in order to point in the same direction as x x, as shown in Figure 1. Thus

u x = α x . u x = α x . (2)
Figure 1: The Unit Vector ux
A Cartesian graph with a line originating at the origin and extending up and to the left. The line actually consist of two arrows in a line. The first arrow ends in a point. Below the point is the expression U_x. From the arrow point to the y axis is an arch. The arch ends at the y axis and to the left of the point where it end is the number 1. Another proceeds from where the previous arrow ended and proceeds along the same slope, ends in an point and up and to the left of the point is an X.

But what is α α? We need to choose α α so that the norm of u x u x will be 1:

| | u x | | = 1 | | u x | | = 1 (3)
| α x | | = 1 | α x | | = 1 (4)
| α | | | x | | = 1 | α | | | x | | = 1 (5)
α = 1 | | x | | α = 1 | | x | | (6)

We have dropped the absolute value bars on α α because ||x||||x|| is positive. The α α that does the job is 1 over the norm of x x. Now we can write formulas for u x u x in terms of x x and xx in terms of u x u x :

u x = 1 | | x | | x , u x = 1 | | x | | x , (7)
x = | | x | | u x . x = | | x | | u x . (8)

So the vector x x is its direction vector u x u x , scaled by its Euclidean norm.

Unit Coordinate Vectors. There is a special set of unit vectors called the unit coordinate vectors. The unit coordinate vector e i e i is a unit vector in n n that points in the positive direction of the ithith coordinate axis. Figure 2 shows the three unit coordinate vectors in 3 3 .

Figure 2: Unit Coordinate Vectors in R3
Figure 2 is a three-dimensional graph describing the coordinate vectors. The axis pointing out towards the screen is labeled x_1, the axis pointing to the right is labeled x_2 and the axis pointing up is labeled x_3. There are three vectors in the diagram, and each follow an axis, are labeled with an e and the corresponding subscript of the axis on which they are drawn, and are of length 1.

For three-dimensional space, R 3 R 3 , the unit coordinate vectors are

e 1 = 1 0 0 , e 2 = 0 1 0 , e 3 = 0 0 1 . e 1 = 1 0 0 , e 2 = 0 1 0 , e 3 = 0 0 1 . (9)

More generally, in n-dimensional space, there are n n unit coordinate vectors given by

Figure 3
Figure 3 is a vector e_1 with arrows pointing to a specific entry in the vector, designating the i-th element, and to the last entry in the vector, designating a total of n elements.

You should satisfy yourself that this definition results in vectors with a norm of l.

Exercise 1

Find the norm of the vector au where u u is a unit vector.

Exercise 2

Find the unit vector u x u x in the direction of

  1. x=34x=34 ;
  2. x=36-2x=36-2 ;
  3. x=1-11-1.x=1-11-1.

Direction Cosines. We often say that vectors “have magnitude and direction.” This is more or less obvious from "Linear Algebra: Vectors", where the three-dimensional vector x x has length x12+x22+x32x12+x22+x32 and points in a direction defined by the components x1,x2x1,x2, and x 3 x 3 . It is perfectly obvious from Equation 8 where x x is written as x=||x||uxx=||x||ux. But perhaps there is another representation for a vector that places the notion of magnitude and direction in even clearer evidence.

Figure 4 shows an arbitrary vector xR3xR3 and the three-dimensional unit coordinate vectorse1,e2,e3e1,e2,e3. The inner product between the vector x x and the unit vector e k e k just reads out the kthkth component of x x:

(x,ek)=(ek,x)=xk.(x,ek)=(ek,x)=xk.(10)

Since this is true even in R n R n , any vector xRnxRn has the following representation in terms of unit vectors:

x = ( x , e 1 ) e 1 + ( x , e 2 ) e 2 + + ( x , e n ) e n . x = ( x , e 1 ) e 1 + ( x , e 2 ) e 2 + + ( x , e n ) e n . (11)
Figure 4: The Three-Dimensional Unit Vectors
Figure four is a three-dimensional graph with four vectors and measured angles between the vectors. Along the axis that moves towards the screen is the vector e_1, [1 0 0]. Along the axis moving up the page is the vector e_3, [0 0 1]. The angle between e_1 and e_3 is labeled θ_1. A third vector is drawn along the axis that moves to the right, and is labeled e_2 [0 1 0]. The angle between e_2 and e_3 is labeled θ_2. A fourth and final vector is drawn in the positive e_1 e_2 and e_3 directions, and is labeled x. The magnitude of x is labeled as ||x||. The angle between x and e_3 is labeled as θ_3. The angle between the projection of x onto the e_1 e_2 axis and the vector e_1 is labeled Φ.

Let us now generalize our notion of an angle θ θ between two vectors to R n R n as follows:

cosθ=(x,y)||x||||y||cosθ=(x,y)||x||||y|| (12)

The celebrated Cauchy-Schwarz inequality establishes that -1--1- cos θ1θ1. With this definition of angle, we may define the angle θ k θ k that a vector makes with the unit vector e k e k to be

cosθk=(x,ek)||x||||ek||cosθk=(x,ek)||x||||ek|| (13)

But the norm of e k e k is 1, so

cos θ k = ( x , e k ) | | x | | = x k | | x | | cos θ k = ( x , e k ) | | x | | = x k | | x | | (14)

When this result is substituted into the representation of x in Equation 11, we obtain the formula

x = | | x | | c o s θ 1 e 1 + | | x | | c o s θ 2 e 2 + + | | x | | c o s θ n e n = | | x | | ( cos θ 1 e 1 + cos θ 2 e 2 + + cos θ n e n ) . x = | | x | | c o s θ 1 e 1 + | | x | | c o s θ 2 e 2 + + | | x | | c o s θ n e n = | | x | | ( cos θ 1 e 1 + cos θ 2 e 2 + + cos θ n e n ) . (15)

This formula really shows that the vector x x has “magnitude” ||x||||x|| and direction (θ1,θ2,...,θn)(θ1,θ2,...,θn) and that the magnitude and direction are sufficient to determine x x. We call ( cosθ1cosθ1, cos θ2,...θ2,..., cos θ n θ n ) the direction cosines for the vector x x. In the three-dimensional case, they are illustrated in Figure 4.

Exercise 3

Show that Equation 12 agrees with the usual definition of an angle in two dimensions.

Exercise 4

Find the cosine of the angle between x x and y y where

  1. x=100,y=222x=100,y=222 ;
  2. x=1-11-1,y=-1010x=1-11-1,y=-1010 ;
  3. x=21-2,y=42-4x=21-2,y=42-4

If we compare Equation 8 and Equation 15 we see that the direction vector u x u x is composed of direction cosines:

u x = cos θ 1 e 1 + cos θ 2 e 2 + + cos θ n e n = c o s θ 1 c o s θ 2 c o s θ n . u x = cos θ 1 e 1 + cos θ 2 e 2 + + cos θ n e n = c o s θ 1 c o s θ 2 c o s θ n . (16)

With this definition we can write Equation 15 compactly as

Here x x is written as the product of its magnitude ||x||||x|| and its direction vector u x u x . Now we can give an easy procedure to find a vector's direction angles:

(i) find ||x||||x||;

(ii) calculate ux=x||x||ux=x||x||; and

(iii) take the arc cosines of the elements of u x u x .

Step (iii) is often unnecessary; we are usually more interested in the direction vector (unit vector) ux. Direction vectors are used in materials science in order to study the orientation of crystal lattices and in electromagnetic field theory to characterize the direction of propagation for radar and microwaves. You will find them of inestimable value in your courses on electromagnetic fields and antenna design.

Exercise 5

Sketch an arbitrary unit vector uR3uR3. Label the direction cosines and the components of u.Su.S

Exercise 6

Compute the norm and the direction cosines for the vector x=426.x=426.

Exercise 7

Prove that the direction cosines for any vector satisfy the equality

cos 2 θ 1 + cos 2 θ 2 + + cos 2 θ n = 1 . cos 2 θ 1 + cos 2 θ 2 + + cos 2 θ n = 1 . (17)

What does this imply about the number of scalars needed to determine a vector xRnxRn ?

Exercise 8

Astronomers use right ascension, declination, and distance to locate stars. On Figure 4 these are, respectively, -φ,π2-θ3-φ,π2-θ3, and ||x||||x||. Represent x=(x1,x2,x3)x=(x1,x2,x3) in terms of φ,θ3φ,θ3, and ||x||||x|| only. (That is, find equations that give φ,θ3φ,θ3, and ||x||||x|| in terms of x1,x2x1,x2, and x3, and find equations that give x1,x2x1,x2, and x3 in terms of φ,θ3φ,θ3, and ||x||.)||x||.)

Exercise 9

(MATLAB) Write a MATLAB function that accepts any vector xRnxRn and computes its norm and direction cosines. Make x an input variable, and make ||x||||x|| and u x u x output variables.

Exercise 10

Let x x and y y denote two vectors in R n R n with respective direction cosines ( cos θ 1 , cos θ 2 , ... , cos θ n cos θ 1 ,cos θ 2 , ... ,cos θ n ) and ( cos φ 1 , cos φ 2 , ... , cos φ n cos φ 1 ,cos φ 2 , ... ,cos φ n ). Prove that ψ ψ, the angle between x x and y y, is

cos ψ = cos θ 1 cos φ 1 + cos θ 2 cos φ 2 + + cos θ n cos φ n . cos ψ = cos θ 1 cos φ 1 + cos θ 2 cos φ 2 + + cos θ n cos φ n . (18)

Specialize this result to R 2 R 2 for insight.

Exercise 11

Compute the angle between the vectors x=230x=230 and 231231. Sketch the result.

Content actions

Give Feedback:

E-mail the module author | Rate module ( How does the rating system work?)

Rating system

Ratings

Ratings allow you to judge the quality of modules. If other users have ranked the module then its average rating is displayed below. Ratings are calculated on a scale from one star (Poor) to five stars (Excellent).

How to rate a module

Hover over the star that corresponds to the rating you wish to assign. Click on the star to add your rating. Your rating should be based on the quality of the content. You must have an account and be logged in to rate content.

(0 ratings)

Download:

Add module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections directly in Connexions. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need a Connexions account to use 'My Favorites'.

| A lens (?)

Definition of a lens

Lenses

A lens is a custom view of Connexions content. You can think of it as a fancy kind of list that will let you see Connexions through the eyes of organizations and people you trust.

What is in a lens?

Lens makers point to Connexions materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

Who can create a lens?

Any individual Connexions member, a community, or a respected organization.

What are tags? tag icon

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks