CommencerCommencer gratuitement

Reflections

In the last exercise, you looked at stretching or shrinking components of a vector.

In this one, you'll apply a reflection matrix to the vector b <- c(2, 1).

Cet exercice fait partie du cours

Linear Algebra for Data Science in R

Afficher le cours

Instructions

  • A, B, C and b are loaded for you. Use matrix multiplication in R to show that multiplication by the matrix \(A\) with R output:
> A
     [,1] [,2]
[1,]    -1    0
[2,]    0    1

reflects the vector b = c(2, 1) about the y axis.

  • Show that multiplication by the matrix \(B\) with R output:
> B
     [,1] [,2]
[1,]    1    0
[2,]    0   -1

reflects b about the x axis.

  • What does the matrix \(C\) with R output:
> C
     [,1] [,2]
[1,]    -4    0
[2,]    0    -2

do to b?

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Multiply A by b
A%*%___

# Multiply B by b 
___%*%b

# Multiply C by b 
C___b
Modifier et exécuter le code