  In this paper, using properties of Ramanujan sums and of the discrete Fourier
transform of arithmetic functions, we give an explicit formula for the number
of solutions of the linear congruence $a_1x_1+\cdots +a_kx_k\equiv b \pmod{n}$,
with $\gcd(x_i,n)=t_i$ ($1\leq i\leq k$), where $a_1,t_1,\ldots,a_k,t_k, b,n$
($n\geq 1$) are arbitrary integers. As a consequence, we derive necessary and
sufficient conditions under which the above restricted linear congruence has no
solutions. The number of solutions of this kind of congruence was first
considered by Rademacher in 1925 and Brauer in 1926, in the special case of
$a_i=t_i=1$ $(1\leq i \leq k)$. Since then, this problem has been studied, in
several other special cases, in many papers; in particular, Jacobson and
Williams [{\it Duke Math. J.} {\bf 39} (1972), 521--527] gave a nice explicit
formula for the number of such solutions when $(a_1,\ldots,a_k)=t_i=1$ $(1\leq
i \leq k)$. The problem is very well-motivated and has found intriguing
applications in several areas of mathematics, computer science, and physics,
and there is promise for more applications/implications in these or other
directions.
