Quaternary quadratic forms and Elliptic curves via Langlands? The content of this note was the topic of a lecture by Günter Harder at the School on Automorphic Forms, Trieste 2000. The actual problem comes from the article 

A little bit of number theory by Langlands.
The problem is about a connection between two quite different objects. The first object
is the following pair of positive definite quadratic forms:
$$ P(x,y,u,v)  =  x^2 + xy + 3y^2 + u^2 + uv + 3v^2 $$
$$ Q(x,y,u,v)  =  2(x^2 + y^2 + u^2 + v^2) + 2xu + xv + yu - 2yv $$
The second object is the elliptic curve
$$ E: y^2 + y = x^3 - x^2 - 10x - 20. $$
To each of our objects we now associate a series of integers. 
For each integer $k \ge 0$ define
$$ n(P,k)  =  | \{(a,b,c,d) \in {\mathbb Z}^4: P(a,b,c,d) = k\} |, $$
$$ n(Q,k)  =  | \{(a,b,c,d) \in {\mathbb Z}^4: Q(a,b,c,d) = k\} |. $$
As a matter of fact, these integers are divisible by $4$ for any
$k \ge 1$ because of the transformations $(a,b,c,d) \to (-a,-b,-c,-d)$
and $(a,b,c,d) \to (c,d,a,b)$.
For any prime $p \ne 11$ we now put
$$ a_p =  |E({\mathbb F}_p)| - (p+1),$$
where $E({\mathbb F}_p)$ is the elliptic curve over ${\mathbb F}_p$ defined above. 
Then Langlands claims
For any prime $p \ne 11$, we have 
$ 4a_p = n(P,p) - n(Q,p).$
The "classical" explanation proceeds as follows: Given the series of integers $n(P,p)$ and $n(Q,p)$, we form the generating series
$$ \Theta_P(q)  = \sum \limits_{k=0}^\infty n(P,k) q^k 
         = 1 + 4q + 4q^2 + 8q^3 + \ldots, $$
$$ \Theta_Q(q)  = \sum \limits_{k=0}^\infty n(Q,k) q^k
         = 1 + 12q^2 + 12q^3 + \ldots. $$
If we put $q = e^{2\pi i z}$ for $z$ in the upper half plane, then $\Theta_P$ and $\Theta_Q$ become ${\mathbb Z}$-periodic holomorphic functions on the upper half plane. As a matter of fact, the classical theory of modular forms shows that the function 
$$ f(z)  =  \frac14 (\Theta_P(q) - \Theta_Q(q))  
         =  q - 2q^2 - q^3 + 2q^4 + q^5 + 2q^6 - 2q^7 - 2q^9 - 2q^{10}
  + q^{11} - 2q^{12} \ldots $$
is a modular form (in fact a cusp form since it vanishes at $\infty$) of weight $2$ for 
$\Gamma_0(11)$. More precisely, we have $ f(z) = \eta(z)^2 \eta(11z)^2,$ where $\eta(z)$ is Dedekind's eta function, a modular form of weight $\frac12$. 
Now we have connected the quadratic forms to a cusp form for $\Gamma_0(11)$. This group has two orbits on the projective line over the rationals, which means that the associated Riemann surface can be compactified by adding twocusps: the result is a compact Riemann surface $X_0(11)$ of genus $1$. Already Fricke has given a model for this Riemann surface: he found that $X_0(11) \simeq E$ for the elliptic curve defined above.
Now consider the space of cusp forms for $\Gamma_0(11)$. There are Hecke operators $T_p$ acting on it, and since it has dimension $1$, we must have $T_p f = \lambda_p f$ for
certain eigenvalues $\lambda_p \in {\mathbb Z}$. A classical result due to Hecke then predicts that the eigenvalue $\lambda_p$ is the $p$-th coefficient in the $q$-expansion of $f(z)$. Eichler-Shimura finally tells us that $\lambda_p = a_p$. Putting everything together gives Langlands' claim.
Way back then I asked Harder how all this follows from the general Langlands conjecture, and he replied that he did not know. Langlands himself said his examples came "from 16 of  Jacquet-Langlands". So here's my question:
 Does anyone here know how to dream up concrete results like the one above from Langlands' conjectures, or from "16 of Jacquet-Langlands"? 
 A: Chapter 16 of Jacquet--Langlands is about the Jacquet--Langlands correspondence, which concerns the transfer of automorphic forms from quaternion algebras to the group $GL_2$.
The modularity of the theta series that you write down is a (very) special case of this 
correspondence.
But probably Langlands more had in mind going the other way, in the following sense:
in Chapter 16, Jacquet and Langlands not only show the existence of transfer, they characterize its image.
In particular, their results show that the modular form $f$ is in the image of transfer from
the definite quaternion algebra $D_{11}$ ramified at $\infty$ and 11.  Thus one knows {\em a priori}
that there has to be a formula relating $f$ to the $\Theta$-series of some rank four quadratic forms associated to $D_{11}$; it is then a simple matter to compute them 
precisely (here one uses the fact that $f$ is a Hecke eigenform, and the compatibility of
transfer with the Hecke action), and hence obtain the formula $f = (\Theta_P - \Theta_Q)/4.$
The question of characterizing the image of transfer is an automorphic interpretation of what is classically sometimes called the Eichler basis problem: the problem of computing the span of the theta series arising from definite quaternion algebras. The name comes from the fact that the particular case considered here (but with 11 replaced by an arbitrary prime $p$), namely the fact that modular forms of weight two and prime conductor $p$ are spanned by theta series coming from $D_p$, was I think first proved by Eichler in 1955.
A: I would like to add to Emerton's answer that Eichler gave a proof for square free level in Modular functions of one variable I, Springer Lecture Notes 320.
Further classical work on the basis problem is in:
MR0960090 (90d:11056) Hijikata, Hiroaki; Pizer, Arnold K.; Shemanske, Thomas R. The basis problem for modular forms on $\Gamma_0(N)$. Mem. Amer. Math. Soc. 82 (1989), no. 418
Yet another reference:
MR0333081 (48 #11406) Shimizu, Hideo Theta series and automorphic forms on ${\rm GL}_{2}$. J. Math. Soc. Japan 24 (1972), 638--683
