# What is the gauge group of eletromagnetism?

Gauge transformations allowed by physical theories form groups. For example, a wave function in quantum mechanics can be multiplies by $e^{i\theta}$ and this won't change a thing. So the gauge group of this theory is $U(1)$.

Now, the Maxwell equations can be written in terms of a scalar $\phi$ and a vector potential $\vec{A}$ (I don't write them here since they are very well known). They admit gauge transformations in which $\vec{A}\to\vec{A}+\vec{\nabla} f$ and $\phi\to\phi+\partial_t f$ (up to some factors), where $f(\vec{r},t)$ can be any differentiable function.

Since I can take any function, I conclude that the gauge group of electromagnetism is infinite-dimensional. Is this correct?

No, the gauge group of electromagnetism is still $\mathrm{U }(1)$. This is because there is a difference between the gauge group $G$ of a physical theory on a manifold $M$ and the group of gauge transformations $\mathcal{G}$ consisting of local functions $M\to G$ and the algebra of infinitesimal gauge transformations consisting of local functions $M\to\mathfrak{g}$ for $\mathfrak{g}$ the Lie algebra of $G$.
The group of gauge transformations is indeed typically infinite-dimensional, and in your example you have observed that the algebra of infinitesimal gauge transformation of a $\mathrm{U}(1)$-theory on flat $\mathbb{R}^4$ is just the (infinite-dimensional) algebra of smooth functions $\mathbb{R}^4\to\mathbb{R}$. Since $\mathfrak{u}(1)\cong\mathbb{R}$ (the tangent space of a circle is just the real line), this is indeed an infinitesimal gauge transformation in the above sense.