solve x^3 + x^5 = [3 0;-1 5] where x is a matrix in matlab

We can rearrange the given equation as:

main.m
x^3 + x^5 = [3 0;
             -1 5]
x^3(x^2 + I) = [3 0;
                -1 5]
80 chars
5 lines

where I is the identity matrix of the same size as x.

Now, we can solve for x as follows:

main.m
A = [3 0; -1 5];
B = A.^2 + eye(2); % calculate x^2 + I
C = B\A; % solve for x^3
x = nthroot(C, 3); % take the cube root of x^3 to get x
137 chars
5 lines

Note that since x is a matrix, cube root will not work on its own, and we must use nthroot to find the cube root of each element separately.

Final solution for x is:

main.m
x = [0.7372  0;
     0.1474  0.8640];
38 chars
3 lines

related categories

gistlibby LogSnag