# C1W3_Assignment - Exercise 2

Guys,

Does anyone could help me or give me a tip about the folowiing code?
I am having dificult to create a π((π₯,π¦))=(π₯+ππ¦,π¦).

def T_hshear(m, v):
ββ"
Performs a 2D horizontal shearing transformation on an array v using a shearing factor m.

Args:
m (float): The shearing factor.
v (np.array): The array to be sheared.

Returns:
np.array: The sheared array.
"""

### START CODE HERE ###
# Define the transformation matrix
T = np.array([[None,None], [None,None]])
# π((π₯,π¦))=(π₯+ππ¦,π¦)

# Compute the transformation
w = None @ None

### END CODE HERE ###

return w


Hey there @renan_leme

To create the horizontal shearing transformation T((x,y)) = (x + my, y) , you need to define the transformation matrix T and apply it to the input vector v . The transformation matrix for this shearing operation is:

T = \begin{bmatrix} 1 & m \\ 0 & 1 \end{bmatrix}

Hope it helps! Feel free to ask if you need further assistance.

1 Like

Thanks @Alireza_Saei. You always save me!

1 Like

Youβre welcome! Glad I could help!