To rewrite a product of sinuses and cosinuses as a finite Fourier sum, we
can use the function **trigreduce**:

trigreduce(sin(x)^3*cos(x));

We obtain:

2 sin(2 x) - sin(4 x) --------------------- 8

To obtain a representation that does not contain trigonometric functions of multiple angles, we write:

trigexpand(%);

3 3 4 cos(x) sin (x) - 4 cos (x) sin(x) + 4 cos(x) sin(x) ----------------------------------------------------- 8

This looks still a bit unsatisfactory, but we can now use
**trigsimp** to perform simplifications that use the
Pythagorean identity

sin(x)^2 + cos(x)^2 = 1:

trigsimp(%);

3 cos(x) sin (x)

Here we obtained exactly the exression that we started with. This is not always possible. Let us look at this example:

A lot of questions on various mailing lists are about problems that require sophisticated simplification of trigonometric expressions. Some time ago, a maxima user ran into trouble when he solved this integral:

result:integrate(9/cos(7*x)^2, x);

Maxima answers

18 sin(14 x) (%o20) ---------------------------------------------- 2 2 7 sin (14 x) + 7 cos (14 x) + 14 cos(14 x) + 7

which is not a very beautiful solution. The user knew that

9*tan(7*x) ---------- 7

is an integral for

9 --------- 2 cos(7*x)

but found it difficult to simplify the answer from Maxima into this form. He found it also difficult to prove that the derivative of the answer is in fact the integrand. Let us look at both problems:

We can try to simplify the answer with **trigsimp**:

simp1: trigsimp(result);

and obtain

9 sin(14 x) --------------- 7 cos(14 x) + 7

The use of **trigexpand** is not helpful: This function would rewrite sin(14*x)
and cos(14*x) in terms of sin(x) and cos(x). We would rather wish to rewrite sin(14*x)
and cos(14*x) in terms of sin(7*x) and cos(7*x). This is possible, but only with
a trick: We have to replace 14*x with 2*y:

simp1, 14*x=2*y;

9 sin(2 y) -------------- 7 cos(2 y) + 7

Now we can apply **trigexpand**:

trigexpand(%);

18 cos(y) sin(y) ------------------------- 2 2 7 (cos (y) - sin (y)) + 7

trigsimp(%);

9 sin(y) -------- 7 cos(y)

A final **trigreduce** gives the desired result:

trigreduce(%);

9 tan(y) -------- 7

To obtain the original integrand, we have to undo the variable substitution:

%, y = 7*x;

9 tan(7*x) ---------- 7

A variable substitution is a powerful instrument to influence simplification with
**trigexpand**.

It should be mentioned that the given problem can be simplified much faster:

trigrat(result);

9 sin(7 x) ---------- 7 cos(7 x)

trigreduce(%);

9 tan(7*x) ---------- 7

Now let us look at the derivative of the result:

(%i7)deriv: diff(result, x);

252 cos(14 x) ---------------------------------------------- 2 2 7 sin (14 x) + 7 cos (14 x) + 14 cos(14 x) + 7 2 3528 sin (14 x) + ------------------------------------------------- 2 2 2 (7 sin (14 x) + 7 cos (14 x) + 14 cos(14 x) + 7)

First let us try **trigrat**, the function that turned out to be so
helpful in the previous example:

trigrat(deriv);

18 (%o8) ------------- cos(14 x) + 1

Well, this is simplified, but it is still not what we hoped for.
Let us try a variable substitution and a **trigexpand**:

%, 14*x = 2*y; 18 (%o9) ------------ cos(2 y) + 1 trigexpand(%); 18 (%o10) ----------------------- 2 2 - sin (y) + cos (y) + 1 trigsimp(%); 9 (%o11) ------- 2 cos (y) %, y = 7*x; 9 (%o15) --------- 2 cos (7 x)

**trigreduce**rewrites a trigonometric expression as a sum of terms, each of wich contains only a single**sin**or**cos**.**trigexpand**simplifies the arguments of trigonometric function. The sum-of-angles formulas are used for that simplification.**trigsimp**performs various simplifications of trigonometric expression. It uses the identity sin^{2}(x) + cos^{2}= 1 for simplification.**trigrat**simplifies a rational expression in trigonometric functions.