Agreement of $q$-expansion of modular forms If I have modular functions $f$ and $g$ with $f = a_{1} + a_{2}q + \cdots$ and $g = b_{1} + b_{2}a + \cdots$ both $q$-expansions, why does/how does it follow $f = g$ after checking only finitely many terms?

Suppose $f$ and $g$ both have weight $k$ and level $\Gamma$. As John M notes, it is clear that there must exist some constant $N$ depending on $\Gamma$ and $k$ such that if $a_i = b_i$ for $0 \le i \le N$, then $f = g$, since the space $M_k(\Gamma)$ in which both forms live is finite-dimensional. 
This doesn't help you find $N$ though. The simplest general result is the "Sturm bound", which shows that one may take
$$ N = \frac{k d_\Gamma}{12}$$
where $d_\Gamma$ is the index of the image of $\Gamma$ in $\operatorname{PSL}_2(\mathbb{Z})$, which is either equal to or half of the index of $\Gamma$ in $\operatorname{SL}_2(\mathbb{Z})$ depending on whether or not $-1 \in \Gamma$. This is well explained in William Stein's free online textbook "Computing with Modular Forms".
