Solving multivariable trig Identities

I'm trying to solve for a certain set of trig identities in terms of other trig identities. I saw this and this, but in my example, I have two tries:

Solve[{al == Sin[b] Cos[a],
am == Sin[b] Sin[a], an == Cos[b]},
Cos[b], {a, b}]

Solve[{am == Sin[b] Sin[a], an == Cos[b]},
Cos[b], {a, b}]


In the first example, I get a null solution. In the second, Mathematica recognizes that the expression is just 'an'. Apparently I need to building the rule set up from scratch for solve to use, any suggestions here? The actual expressions I plan to use will be more complex, so it failing here isn't giving me much confidence... In the meantime, I'll be trying to generalize the Weierstrass approach.

Edit:

A fuller example might be:

Solve[{al == Sin[b] Cos[a],
am == Sin[b] Sin[a], an == Cos[b]},
Sin[b] Cos[a] + Cos[b]^2, {a, b}]


Giving the result

al+an^2

• Reduce[{al == Sin[b] Cos[a], am == Sin[b] Sin[a], an == Cos[b]}, {a, b}]? May 3, 2022 at 22:54
• I'm not understanding the 2nd argument in all of your examples for Solve. Why do you include Cos[b] and Sin[b] Cos[a] + Cos[b]^2 as the 2nd argument?
– JimB
May 3, 2022 at 23:07
• @JimB I'm referring to this example May 3, 2022 at 23:10
• Thanks. I see (now) what is done in that example. (I'm still looking for that format in the Solve documentation but don't see it. But that's my problem, not yours.)
– JimB
May 3, 2022 at 23:22

1 Answer

Generally you can not solve for a function of a variable (b in the first example) and at the same time try to eliminate that variable. Eliminate the other variables or functions of that.

Solutions to the first example

Solve[{al == Sin[b] Cos[a], am == Sin[b] Sin[a], an == Cos[b]},
Cos[b], {Sin[a], Sin[b], Cos[a]}]


Don't know why second example works, it should not.

Third example: give the expression you are looking for a name and solve for that, eliminating other functions.

Solve[{al == Sin[b] Cos[a], am == Sin[b] Sin[a], an == Cos[b],
fin == Sin[b] Cos[a] + Cos[b]^2}, fin, {Sin[a], Cos[a], Sin[b],
Cos[b]}]

(*  {{fin -> al + an^2}}    *)