# How to simplify my trigonometric fraction

I have the following expression $$\frac{4 \sin(a)}{\sin(a)^2 + \cos(a)^2 + r^4 \sin(a)^4\cos(a)^2 \sin(b)^2 \cos(b)^2 }$$ I would like Mathematica to recognize that this expression can be simplified to $$\frac{4\sin(a)}{1+\frac{1}{4}r^4\sin(a)^4\cos(a)^2\sin(2b)^2} \ \ (1)$$ But although I can do the following

FullSimplify[Cos[a]^2 + Sin[a]^2]
=> 1


and

FullSimplify[Cos[b]^2 Sin[b]^2, ComplexityFunction -> Length]
=> 1/4 Sin[2 b]^2


when I try to use FullSimplify on the whole expression it will give me

FullSimplify[(4 Sin[a])/(Cos[a]^2 + Sin[a]^2 + r^4 Cos[a]^2 Cos[b]^2 Sin[a]^4 Sin[b]^2)]
=> (4 Sin[a])/(Sin[a]^2 + Cos[a]^2 (1 + r^4 Cos[b]^2 Sin[a]^4 Sin[b]^2))


What can I do to transform my fraction into the form $(1)$ ?

• How about '1/(TrigExpand[1/expr] // FullSimplify)' – chris Mar 13 '17 at 8:21

expr = (4 Sin[a])/(Cos[a]^2+Sin[a]^2+r^4 Cos[a]^2 Cos[b]^2 Sin[a]^4 Sin[b]^2);


Why not to simply apply a rule:

    expr /. {Cos[a_]^2 + Sin[a_]^2 -> 1}

(*  (4 Sin[a])/(1 + r^4 Cos[a]^2 Cos[b]^2 Sin[a]^4 Sin[b]^2) *)


?? Have fun!

• Thanks for the hint. I was able to do what I wanted with expr //. { Sin[a]^2 + Cos[a]^2 -> 1, Cos[b]^2*Sin[b]^2 -> 1/4 Sin[2 b]^2} – asmaier Mar 14 '17 at 23:03

I was curious as to if the original workup was right because I was having problems doing this in my head/pencil/paper. Don't judge me.

Anyway, you can't just use MMA's built in commands to simplify things that involve fractions etc because the denominator may be 0 and MMA gives up, At least that's how I always thought of it.

Here's a work around.

(4 Sin[a])/(Cos[a]^2 + Sin[a]^2 + r^4 Cos[a]^2 Cos[b]^2 Sin[a]^4 Sin[b]^2) /. {Cos[a]^2 + Sin[a]^2 -> 1}


gives

(4 Sin[a])/(1 + r^4 Cos[a]^2 Cos[b]^2 Sin[a]^4 Sin[b]^2)


In:= expr = (4 Sin[a])/(Cos[a]^2+Sin[a]^2+r^4 Cos[a]^2 Cos[b]^2 Sin[a]^4 Sin[b]^2)/.{Cos[a]^2+Sin[a]^2-> 1}

Out= (4 Sin[a])/(1+r^4 Cos[a]^2 Cos[b]^2 Sin[a]^4 Sin[b]^2)

In:= expr/. {Sin[a]^4-> Sin[a]^4 (1+Cos[2b])/2*1/Cos[b]^2}

Out= (4 Sin[a])/(1+1/2 r^4 Cos[a]^2 (1+Cos[2 b]) Sin[a]^4 Sin[b]^2)

In:= %/.{Sin[b]^2-> Sin[b]^2 (1-Cos[2b])/(2 Sin[b]^2)}//Simplify

Out= (16 Sin[a])/(4+r^4 Cos[a]^2 Sin[a]^4 Sin[2 b]^2)


Now Why MMA refuses to simplify the following I have no idea.

In:= (16 Sin[a])/(4+r^4 Cos[a]^2 Sin[a]^4 Sin[2 b]^2) ((1/4)/(1/4))
Out= (16 Sin[a])/(4+r^4 Cos[a]^2 Sin[a]^4 Sin[2 b]^2)


Doing it manually like this also fails.

In:= ((1/4)16 Sin[a])/((1/4)(4+r^4 Cos[a]^2 Sin[a]^4 Sin[2 b]^2))
Out= (16 Sin[a])/(4+r^4 Cos[a]^2 Sin[a]^4 Sin[2 b]^2)


But if you were to do this manually,

In:= ((1/4)16 Sin[a])/((1/4)4+(1/4)r^4 Cos[a]^2 Sin[a]^4 Sin[2 b]^2)
Out= (4 Sin[a])/(1+1/4 r^4 Cos[a]^2 Sin[a]^4 Sin[2 b]^2)


Give you the answer you seek.

I really need to refresh up on trig. I can't see why

Sin[b]^2 Cos[b]^2 == 1/4 Sin[2b]^2

Someone work that out by hand so I can see it.

To see how I came up with the replacement rules, see below.

In:= Sin[a]^4== Sin[a]^4 (1+Cos[2b])/2*1/Cos[b]^2//Simplify
Out= True

In:= Sin[b]^2== Sin[b]^2 (1-Cos[2b])/(2 Sin[b]^2)//Simplify


Out= True

• Regarding the trig identities: $\sin(2b)=2 \sin(b) \cos(b)$ is a well-known identity. It can be derived from the angle addition identity, $\sin(a+b)=\sin(a)\cos(b)+\cos(a)\sin(b)$, which I believe can be derived from simpler principles (e.g., 2-dimensional rotation matrices). – jjc385 Mar 14 '17 at 22:51
• I don't remember it! Where did you find it? Show work. =P – bo reddude Mar 14 '17 at 22:59
• Identities and proofs from Wikipedia, but a lot of people just have them memorized. – jjc385 Mar 14 '17 at 23:07
• Also, if you want to force Mathematica to multiply the numerator and denominator by a common factor, you can use something like mapNumDenom[ff_, expr_] := ff@Numerator@expr/ff@Denominator@expr and then mapNumDenom[ Distribute[#/4]&, expr ]. I also frequently use similarly defined mapNum and mapDenom functions that apply only to the numerator or denominator. Feel free to add this to your answer if you would like. – jjc385 Mar 14 '17 at 23:14
• I would if I could understand that code... – bo reddude Mar 14 '17 at 23:40