In mathematical analysis, the Weierstrass approximation theorem states that every continuous function defined on a closed interval $[a, b]$ can be uniformly approximated as closely as desired by a polynomial function.
In Fourier analysis, if $f$ satisfies the three Dirichlet conditions, that is:
(i) $f(x)$ must have a finite number of extrema in any given interval, i.e. there must be a finite number of maxima and minima in the interval.
(ii) $f(x)$must have a finite number of discontinuities in any given interval, however the discontinuity cannot be infinite.
(iii) $f(x)$ must be bounded.
Then $f(x)$ has a Fourier series that converges to it.
I am wondering, more generally, if something like or some version of the following general theorem is true:
If $(f_i)_{i\in \mathbb{N}}\ $ is a sequence of bounded, (continuous?) linearly independent functions, that is, for each $n\in\mathbb{N},\ \ c_1, c_2, \ldots, c_n,\ $ all in $\mathbb{R},$ such that, $\displaystyle\sum_{j=1}^{j=n} c_j f_j=0,\ $ then $\ c_i = 0\ \forall i\in \{1,2,\ldots,n\}.$ Then, if $\ f\ $ has the Dirichlet conditions or alternatively if $f$ is continuous, then $\ \exists\ (c_n)_{n\in\mathbb{N}}\in {\mathbb{R}}^{\mathbb{N}}\ $ such that $f \equiv \displaystyle\sum_{i=1}^{\infty} c_i f_i. $
Is there some well-known generalised theorem of this form? Or is it all nuanced, and depends on the specifics? Or am I being all weird and confused?
Yes, there is a theorem that says something like what you want. As has been mentioned in the comments, it's called the Stone-Weierstrass Theorem, and it's true in very high generality. One of its corollaries, though, is this:
Notice that condition $1$ is closely related to your "linear independence" condition. It says that $\mathcal{F}$ should be a vector subspace of all continuous functions, and should moreover be closed under multiplication (we can say this quickly by saying "$\mathcal{F}$ is a subalgebra of the algebra of continuous functions"). This is a very mild strengthening of your "linear independence" condition that takes more general products of functions into account. For instance, if we define $\mathcal{F}$ by fixing a basis, then this is your linear independence condition with the ~bonus condition~ that the product of two basis elements lands in the span of that basis.
Condition $2$ says that your basis had better include the constant $1$ function, which is a sort of obvious requirement if you think about it. After all, think about the polynomials generated by $\{x, x^2, x^3, x^4, \ldots \}$. These all have $0$ constant term, and so for every such polynomial we have $p(0) = 0$. So how could we possibly approximate a function with $p(0) \neq 0$? This also provides an explicit answer to the question you asked Robert Israel in the comments, since $\{x, x^2, x^3, \ldots\}$ is linearly independent (and closed under multiplication too!) but "its span isn't dense" (you can't approximate arbitrary functions by elements of its span). But notice the constant $1$ function is in the set of polynomials (as $x^0$) and in the set of trigonometric polynomials (as $\cos(0x)$).
Condition $3$, finally, says that we can separate points. Imagine we took $\mathcal{F} = \{ \text{all polynomials $p$ so that } p(0) = p(1) \}$. It's worth checking that this is a subalgebra that contains the constant $1$ polynomial. So it satisfies conditions $1$ and $2$. Of course, in $\mathcal{F}$ we always have $p(0) = p(1)$! So how could we possibly approximate a function where $p(0) \neq p(1)$? We won't be able to! For an incredibly silly example, take $\mathcal{F} = \{ \text{just the constant functions} \}$. Again, this is a subalgebra containing $1$, but I think it's clear that you have no shot of approximating all continuous functions using these! (So again, we say that $\mathcal{F}$ is not dense in the space of all continuous functions).
What's incredible is that these three (obviously necessary) conditions are enough! The Stone-Weierstrass theorem says that if you have any family of functions that's a subalgebra, containing $1$, and separates points, you can approximate any continuous function using functions from that family! And this is true for continuous functions defined on spaces much more general than intervals $[a,b]$, as well as for codomains much more general than $\mathbb{R}$!
So to rephrase this in terms of a basis (so that it looks as similar to your proposed theorem as possible), the following is true:
I hope this helps ^_^