Conteúdo do Curso
Mathematics for Data Analysis and Modeling
Mathematics for Data Analysis and Modeling
Scaling Factor of the Linear Transformation
In the context of matrices, a linear transformation refers to a mathematical operation that takes a vector or matrix as input and produces a transformed vector or matrix as output. A transformation matrix represents this transformation. To apply the transformation, we multiply the transformation matrix by the vector or matrix that needs to be transformed.
We have already mentioned in the previous chapter that the determinant of the transformation matrix influences the scale of the resulting vector. Let's consider an example to understand it.
Let's create several plots to demonstrate the difference between linear transformations with matrices of different determinants. We will focus on how the determinant affects the scaling of the transformation.
First Transformation (High Determinant):
import numpy as np import matplotlib.pyplot as plt # Matrix with a high determinant A = np.array([[2, 0], [0, 3]]) # Vector to be transformed v = np.array([1, 1]) # Apply the transformation result_A = np.dot(A, v) # Plot the graph plt.quiver(0, 0, v[0], v[1], angles='xy', scale_units='xy', scale=1, color='blue', label='Original Vector') plt.quiver(0, 0, result_A[0], result_A[1], angles='xy', scale_units='xy', scale=1, color='red', label='Transformed Vector (High Determinant)') # Set the graph limits plt.xlim(-5, 5) plt.ylim(-5, 5) # Add labels and legend plt.xlabel('x') plt.ylabel('y') plt.title(f'Determinant is {np.linalg.det(A)}') plt.legend() # Show the graph plt.show()
Second Transformation (Low Determinant):
import numpy as np import matplotlib.pyplot as plt # Matrix with a low determinant B = np.array([[0.5, 0.1], [0.3, 0.5]]) # Vector to be transformed v = np.array([1, 1]) # Apply the transformation result_B = np.dot(B, v) # Plot the graph plt.quiver(0, 0, v[0], v[1], angles='xy', scale_units='xy', scale=1, color='blue', label='Original Vector') plt.quiver(0, 0, result_B[0], result_B[1], angles='xy', scale_units='xy', scale=1, color='red', label='Transformed Vector (Low Determinant)') # Set the graph limits plt.xlim(-1, 3) plt.ylim(-1, 3) # Add labels and legend plt.xlabel('x') plt.ylabel('y') plt.title(f'Determinant is {np.linalg.det(B)}') plt.legend() # Show the graph plt.show()
Scaling factor of the transformation
Scaling represents the vector's change in length after the transformation. A higher determinant leads to a larger scaling factor, causing the transformed vector to be more stretched than the original vector. Conversely, a lower determinant results in a smaller scaling factor, leading to less stretching of the transformed vector.
Note
It's necessary to admit that in the case when
det(A) = 0
ordet(A) = 1
, we can't make any conclusions about the scaling factor of the matrix without additional analysis of the matrix structure.
Obrigado pelo seu feedback!