If n = Product_{i=1..k} (p_i)^(e_i), then SO(2,Z_n) = Product_{i=1..k} SO(2,(p_i)^(e-i)), so we can only study the group structure of SO(2,Z_p^e). If p == 3 (mod 4), then |SO(2,Z_p^e)| = (p+1)*p^(e-1). Let P = [p,t;-t,p], where t^2 == 1-p^2 (mod p^e), then P is a member of SO(2,Z_p^e) of order 4*p^(e-1); let Q = [x,y;-y,x], where x+yi == g^(p^(e-1)*(p-1)) (mod p^e), g is any element of maximum order in the group (Z[i]/(p^e)Z[i])* = C_p^(e-1) X C_((p^2-1)*p^(e-1)) (group of Gaussian integers modulo p^e), then we have x^2+y^2 = Norm(g)^(p^(e-1)*(p-1)) == 1 (mod p^e), so Q is a member of SO(2,Z_p^e) of order ((p^2-1)*p^(e-1)) / (p^(e-1)*(p-1)) = p+1. Since gcd(p^(e-1),p+1) = 1, we have P^4 * Q is of order (p+1)*p^(e-1). So SO(2,Z_p^e) = C_((p+1)*p^(e-1)), and it is generated by M = P^4 * Q. For example, if p^e = 49, then we can choose t = 1, so P = [7,1;-1,7]; g = 2+i, then x+yi = (2+i)^42 == 44+5i (mod 49), so Q = [44,5;-5,44]. SO(2,Z_49) is isomorphic to C_56 generated by M = P^4 * Q = [37,47;2,37]. If p == 1 (mod 4), then |SO(2,Z_p^e)| = (p+1)*p^(e-1). Let M = [(g+g^(-1))/2,t*(g-g^(-1))/2;-t*(g-g^(-1))/2,(g+g^(-1))/2], where g is any primitive root modulo p^e, t^2 == -1 (mod p^e), it is easy to see M^k = [(g^k+g^(-k))/2,t*(g^k-g^(-k))/2;-t*(g^k-g^(-k))/2,(g^k+g^(-k))/2], so M is a member of SO(2,Z_p^e) of order (p-1)*p^(e-1). So SO(2,Z_p^e) = C_((p-1)*p^(e-1)), and it is generated by M. For example, if p^e = 169, then we can choose g = 2, t = 70, SO(2,Z_169) is isomorphic to C_156 generated by M = [128,137;32,128]. If p = 2 and e >= 4, then |SO(2,Z_p^e)| = 2^(e+1). Note that X = [2^(e-1)+1,0;0,2^(e-1)+1] is a member of SO(2,Z_2^e) of order 2, Y = [0,1;-1,0] is a member of SO(2,Z_2^e) of order 4; let M = [4,t;-t,4], where t^2 == -15 (mod 2^e), then M is a member of SO(2,Z_2^e) of order 2^(e-2). Also, M^(2^(e-4)) = [1,2^(e-2);-2^(e-2),1] or [1,-2^(e-2);2^(e-2),1], it is easy to see the subgroup of SO(2,Z_p^e) generated by X, Y and M^(2^(e-4)) is isomorphic to C_2 X C_4 X C_4. So SO(2,Z_p^e) = C_2 X C_4 X C_2^(e-2), and it is generated by X, Y and M. For example, if 2^e = 1024, then we can choose t = 217, SO(2,Z_1024) is isomorphic to C_2 X C_4 X C_256 generated by X = [513,0;0,513], Y = [0,1;-1,0], M = [4,217;-217,4]. If e = 3, SO(2,Z_8) = C_2 X C_2 X C_4, and it is generated by [5,0;0,5], [7,4;4,7] and [0,1;7,0]. If e = 2, SO(2,Z_4) = C_2 X C_4, and it is generated by [3,0;0,3] and [0,1;3,0]. If e = 1, SO(2,Z_2) = C_2, and it is generated by [0,1;1,0].