First an answer for the special case, then a more general answer.

## Trigonometric functions

In the special case of the example in the question, this helps:

```
sage: f(x) = 17
sage: g(x) = cos(x)^2
sage: h(x) = cos(2*x)
sage: h(x).simplify_trig()
2*cos(x)^2 - 1
```

## Linear independence of functions

Returning to the general question, one way to check for
possible linear dependence relations, or for proofs of
independence, would be to project to a finite-dimensional
subspace and check there.

Form a vectors from the value of each function at
a chosen collection of evaluation points.

If these vectors are linearly independent, then the functions are.

If there is a linear relation between these vectors, then it's worth
checking if the linear relation in fact holds for the functions themselves.

Let us illustrate with the three functions above.

Choose a collection of evaluation points:

```
sage: xx = (0, pi/6, pi/4, pi/3, pi/2)
```

Form a vector for each function:

```
sage: u = vector([f(x) for x in xx])
sage: v = vector([g(x) for x in xx])
sage: w = vector([h(x) for x in xx])
```

To look for dependence relations, compute the left kernel
of the matrix with these vectors as rows.

```
sage: m = matrix([u, v, w])
sage: K = m.kernel()
sage: K
Vector space of degree 3 and dimension 1 over Algebraic Real Field
Basis matrix:
[ 1 -34 17]
```

This suggests that maybe `f - 34*g + 17*h`

is zero.

Extract the coefficients:

```
sage: a, b, c = K.basis()[0]
sage: a, b, c
(1, -34, 17)
```

Check if the linear relation in fact holds for the functions:

```
sage: bool(a*f(x) + b*g(x) + c*h(x) == 0)
True
```