kill(all);

M:matrix
(
    [sin(%theta), -cos(%theta),           1],
    [cos(%theta),            1, sin(%theta)],
    [          1,  sin(%theta), cos(%theta)]
)$ M;

determinant(M)+2=0;

substitute(1-cos(%theta)^2, sin(%theta)^2,%);

trigsimp(%);

f:first(solve(%,%theta));

substitute(x,%theta,f);

f(x):=sin(x)+(cos(x)^3+1)/(cos(x)^2+cos(x)-1);

for i : 0 thru 32 do
if(is(equal(f(i*%pi/4),0))) then print(i*%pi/4);

substitute(0,x,%);

substitute(%pi/2,%theta,%);