0

In this Youtube video, Nathan Kutz explains that if you "hit" a circle with a matrix multiplication, it becomes an ellipse. In the same video, he mentions that a matrix multiplication is linear, so it will stretch any two different vectors by the same amount (minute 9:13 to 9:45). Given the visual that he provided (which I've attached below), I don't see why the circle would go to an ellipse if you're stretching (and rotating) v1 and v2 by the same amount. It seems to me that you would just get a circle with a larger radius.

enter image description here

I've come across a similar question to mine, but I don't think it answers my question.

  • 6
    Matrix multiplication will stretch any two collinear vectors by the same amount – J. W. Tanner Jul 02 '20 at 17:05
  • 6
    "...it will stretch any two different vectors by the same amount": this is simply wrong. It will stretch any two parallel vectors by the same amount. – TonyK Jul 02 '20 at 17:05
  • @TonyK Thanks that helped! Weird that he says that – An Ignorant Wanderer Jul 02 '20 at 17:09
  • Any matrix can be written as $U \Sigma V^T$ (the SVD) where $U,V$ are rotations and $\Sigma$ is diagonal so it 'stretches' theaxes. – copper.hat Jul 02 '20 at 17:12
  • 1
    @copper.hat: Unfortunately, I think the OP is just learning about the SVD, and that's what motivates this question (the video OP links to is about SVD), so your comment will only be helpful in hindsight... – Will R Jul 02 '20 at 17:15
  • 1
    @WillR: Well, it may help, since rotating a circle will just produce a circle, applying $V^T$ will just map a circle to a circle. Multiplying by $\Sigma$ will stretch parallel to the axes producing an ellipse and $U$ just rotates the result giving a rotated ellipse. – copper.hat Jul 02 '20 at 17:22
  • 2
    I think the presenter just misspoke. It is difficult to present and make only correct statements :-). Clearly if I take the diagonal matrix with entries $1,2$ it will stretch the $x,y$ axes differently. – copper.hat Jul 02 '20 at 17:28
  • One way you can think about this is that $A$ will send the zero set of a quadratic equation to the zero set of a quadratic equation. This means that the result can only be a hyperbola, ellipse, parabola, or union of lines. Also, since $A$ preserves bounded shapes, and the only bounded choice from that list that is an ellipse, the result will be a ellipse. I can write this out if it's unclear. I'm not completely sure if this is what you are asking though. – Elle Najt Jul 02 '20 at 17:36

1 Answers1

1

Only eigen vectors(for square matrix) or singlular vectors(for rectangular matrix) are not changed after applying this matrix to any set of data points. Best to see it for yourself. Here is example python code to play with.

Here we are defining matrix and get its eigen vectors and values:

A = np.array([[1, 5], [2, -4]])
L, V = np.linalg.eig(A)

Here we are drawing sample circle with radius one.

angle = np.linspace( 0 , 2 * np.pi , 150 ) 
radius = 1
x = radius * np.cos( angle ) 
y = radius * np.sin( angle )
figure, axes = plt.subplots( 1 )

axes.plot( x, y ) axes.set_aspect( 1 )

And eigen vectors:

for i in range(len(V)):
        x = np.concatenate([[0,0],V[i]])
        plt.quiver([x[0]], [x[1]], [x[2]], [x[3]],
                   angles='xy', scale_units='xy', scale=1, color=colors[i])
plt.title( 'Parametric Equation Circle' ) 
plt.show() 

Result of the code above

And here we draw this circle tranformed by matrix A. As we can see directions of eigen vectors were not changed. And only those.

x= x.reshape(1,-1)
y = y.reshape(1, -1)
transformed_circle_input = np.concatenate((x,y), axis=0)

transformed_circle = np.dot(A,transformed_circle_input) figure, axes = plt.subplots( 1 )

axes.plot( transformed_circle[0,:], transformed_circle[1,:] ) axes.set_aspect( 1 ) eigen1 = V[:,0]L[0] eigen2 = V[:,1]L[1] axes.quiver([0], [0], [eigen1[0]], [eigen1[1]], angles='xy', scale_units='xy', scale=1, color=colors[0],) axes.quiver([0], [0], [eigen2[0]], [eigen2[1]], angles='xy', scale_units='xy', scale=1, color=colors[1],) plt.title( 'Parametric Equation Circle Transformed by matrix A' ) plt.show()

Circle after matrix transformation