First, recall that the matrix corresponding to a rotation by an angle θ is given by:
cos(θ) -sin(θ)
sin(θ) cos(θ)
Now, let's build a 2-by-2 matrix by first rotating by θ1, then stretching using the diagonal matrix D, and finally rotating again by θ2. The resulting matrix A can be calculated as follows:
A = Rot(θ1) D Rot(θ2)