# Evaluating complicated trig without resorting to numerical methods

I have an angle theta given by

Kx = (2/Sqrt[3]) ArcSin[Sqrt[3/10]];
Ky = (2/3) (ArcCos[(1/5) Sqrt[7/10]] - Pi);
theta = Cos[ArcTan[Kx, Ky]];


This evaluates, by use of N[theta] to give 0.5. However I can't seem to get mathematica (by use of FullSimplify, TrigExpand etc.) to work this out exactly (i.e. not numerically) to give me 1/2.

Any suggestions on how to achieve this? Although it's not so important for the above example, I will have other situations where the answer may actually be Sqrt[3] etc. so I don't want to lose that exactness to numerical approximations.

• Have you tried Rationalize[x]? See here and here for "N". – user9660 Feb 18 '15 at 16:35
• Although that suggestion could be a good work around, unfortunately it doesn't work for irrational numbers, and I would like a way to keep my Sqrt[3]'s etc – Tom Feb 18 '15 at 20:51

This is an interesting question demonstrating how related Mathematica trigonometric functions work. Besides recommended purely mathematical approach there are many symbolic tools in the system which one may exploit to get a symbolic result. At first one can think about acting with TrigToExp on the expression and then trying another ways, however then you could find harder problems.

Let's take a look at ComplexityFunction and then examine my answer to an old question FullSimplify does not work on this expression with no unknowns.

For the problem we tackle it is convenient to define such a complexity measure:

cfs[n_][e_] := n ( Count[e, _ArcCos, {0, Infinity}] +
Count[e, _ArcSin, {0, Infinity}] +
Count[e, _ArcTan, {0, Infinity}] +
Count[e, _ArcCot, {0, Infinity}]  ) + LeafCount[e]


Then we can perform some experiments with cfs for various arguments n, morover it is recommended to get rid of the square root by considering theta^2 - 1/4 since one can deduce this value from numerical aproximations, and then we have :

FullSimplify[theta^2 - 1/4, ComplexityFunction -> cfs[100]]

0


If one sets cfs[10] then some expressions involving ArcCosh still remain.

• Curious. I was trying this same approach on Mma v9 and aborted it because it took too much time on my machine. How long does it take on yours? – Dr. belisarius Feb 18 '15 at 17:44
• @belisarius At the moment I work with M9 on an old machine. When I tried e.g. FullSimplify[theta^2, ComplexityFunction -> cfs[500]] it worked about 10 minutes and yielded an unsatisfactory result, however with FullSimplify[theta^2-1/4, ComplexityFunction -> cfs[100]] it took roughly 3 seconds yielding 0. – Artes Feb 18 '15 at 17:59
• Evidently I picked a wrong parameter combination. Thanks a lot. – Dr. belisarius Feb 18 '15 at 17:59
• Huh, interesting that it worked for theta^2 - 1/4 but not theta itself. How did you know/assume this would work? I'm glad there is a way to make this work, but a shame that I might have to play with the expression each time to get something that will compute in a reasonable amount of time. – Tom Feb 18 '15 at 22:32
• @Tom This is from my experience and in fact it is not surprising. One should just realize that easily accesible transformations with FullSimplify may fail to find the appropriate form. This is just a state of art. If you look carefully at the link in my answer you'll find that the simplifying functionality changes from one version of the system to another. One should expect there is no universal tool/approach working on any possible algebraic expressions involving special or trigonometric functions mainly because there are possible different choices of appropriate branch cuts. – Artes Feb 19 '15 at 14:14

Just as @Artes, I started with the expression theta^2 - 1/4. FullSimplify cannot reduce this expression to 0, but with some help it can:

TrigToExp[theta^2 - 1/4 ] // FullSimplify // Together // Factor


This gives a complicated expression with to linear factors in the numerator. Simplify these factors:

FullSimplify /@ %


(* 0 *)

• Would you mind explaining for this simpleton the reason for - 1/4? – Mr.Wizard Feb 18 '15 at 17:54
• @Mr.Wizard Curious. If I remove the - 1/4 from Artes' answer, it doesn't return 1/4 – Dr. belisarius Feb 18 '15 at 18:08
• I have tried a bit without - 1/4 and so far I haven't found a good complextity function. Today I'm not playing with this anymore however the problem is interesting. – Artes Feb 18 '15 at 18:17