Complete the implementation of the vectorRotate function. The function rotates the input column vector, a, by 45 degrees to get b. It then rotates b by 45 degrees to get c. It then checks that the c is perpendicular to a to a tolerance of 1e-10. If they are equal within tolerance, then d should equal 1. Otherwise, d should equal zero.
Step 1: Create a rotation matrix R =
Step 2: Rotate the vector by 45 degrees twice. To rotate a 2D column vector a, by an angle θ, apply the matrix multiplication a_rot = R a.
Step 3: Use an if statement to check whether the corresponding vector c is perpendicular to a. Because of errors associated with floating point arithmetic, we do not want to check orthogonality by checking whether the dot product is equal to zero. Instead, you should check whether the absolute value of the dot product is below a tolerance of 1e-10. If it is, the vectors are orthogonal and d should have a value of 1. Otherwise, d should have a value of 0.