All problems
Reflection Matrix across Line
Problem
Build the 2x2 matrix that reflects across the line through the origin at angle theta degrees:
R = [[cos(2t), sin(2t)], [sin(2t), -cos(2t)]]
with t = radians(theta).
Hint
A reflection matrix is symmetric with determinant -1 and has the line as its +1 eigenspace.
Test cases
case 1
in: [0]
expected: [[1,0],[0,-1]]
case 2
in: [90]
expected: [[-1,0],[0,1]]
case 3
in: [45]
expected: [[0,1],[1,0]]
case 4
in: [30]
expected: [[0.5,0.8660254037844386],[0.8660254037844386,-0.5]]
Starter codePython
def reflection_matrix_2d(theta_degrees):
# Your code here
pass4 test cases · run your code against them in the editor