How can this system of 2 equation

{$\displaystyle A.Cos(x)+B.Sin(x)=tan^2(x)-1$

{$\displaystyle -A.Sin(x)+B.Cos(x)=tan(x)$

have the solution:

$\displaystyle

A=-Cos(x)$

$\displaystyle

B=Sin^3(x)/

Cos^2(x)

$

Note:The Second Solution is $\displaystyle Sin^3(x)$ divided by $\displaystyle Cos^2(x)$

Thanks for Help