I knew that for $ x^2 + y^2 = 1$ the x and y can be expressed by introducing one more variable where $\ m=y/(x+1) $, then $\ x= 2m/(1+m^2) $ and $\ y= (1-m^2)/(1+m^2) $. What about $\ x^2 + 3y^2 = 7 $, should I divide the equation by 7 in order to get the 1 at the right hand side ? Then how to deal with the $\ 3y^2 $ ? Thank you!


7 Answers 7


The key here is to understand where the substitution $$m = \frac{y}{x + 1}$$ comes from. Geometrically, this variable represents the slope of the line between a point $(x, y)$ and the point $(-1, 0)$. What you are then doing is considering a rational slope $m$, taking the line $L$ through $(-1,0)$ of slope $m$, and solving for the second intersection point of this line with the conic $x^2+y^2=1$ (the first intersection point being $(-1,0)$).

This same approach works for any conic, as long as you have a single rational point on the conic to play the role of $(-1,0)$. In the case of $x^2+3y^2=7$, for instance, you could take $(2,1)$ as your initial point. So then you would define $$m = \frac{y - 1}{x - 2}$$ and solve for $(x,y)$ as the second point where the line $L$ through $(2,1)$ of slope $m$ intersects the conic $x^2+3y^2=7$.

  • 1
    $\begingroup$ Thank you so much! $\endgroup$ May 9, 2018 at 2:26

Using the method of pg 7 of this paper on this related equation $$x^2+3y^2=7z^2 \quad \text{with initial solution} \quad (x,y,z)=(2,1,1)$$

A line $y=t(x-2)+1$, which will cut through the ellipse $x^2 + 3y^2 = 7$ at rational points if $t$ is rational.... when substituted into the ellipse yields:

$$\begin{align} x^2+3\left[t(x-2)+1\right]^2&=7 \\ x^2+3\left[t^2(x^2-4x+4)+2t(x-2)+1\right]&=7 \\ (1+3t^2)x^2+(-12t^2+6t)x+(12-12t+3-7)&=0 \\ \text{vieta: the two roots,} \quad x_1, x_2 \quad \text{are such that} \quad -(x_1+x_2)&=\frac{-12t^2+6t}{1+3t^2} \\ \text{since} \quad x_1=2, \quad \text{we have} \quad x_2(t)=\frac{12t^2-6t}{1+3t^2}-2 &=\frac{6t^2-6t-2}{1+3t^2} \\ \text{substituting this} \quad x(t) \quad \text {into the line:} \quad y&=t\left(\frac{6t^2-6t-2}{1+3t^2}-2\right)+1 \\ y(t)=t\left(\frac{-6t-4}{1+3t^2}\right) + \frac{1+3t^2}{1+3t^2}&=\frac{-3t^2-4t+1}{1+3t^2} \end{align}$$

Letting $y(t)\to |y(t)|$, Solution set with one parameter:

$$\begin{cases} x(t)&=\frac{6t^2-6t-2}{1+3t^2} \\ y(t)&=\frac{3t^2+4t-1}{1+3t^2} \end{cases}$$

$t$ was rational, so let $t=\frac{m}{n}$

Solution set now with two parameters: $$\begin{align} x(m,n)&=\frac{6m^2-6mn-2n^2}{n^2+3m^2} \\ y(m,n)&=\frac{3m^2+4mn-n^2}{n^2+3m^2} \end{align}$$


This is not (yet) an answer, but an extended comment, just to have some numerical solutions to crosscheck given analytic solutions in other answers and comments. I document only solutions here with $\gcd(x,y,z)=1$.
Here the third variable $z$ stems from rewriting $ x^2+3 y^2 = 7 $ where $ (x,y) \in \mathbb Q$ by $ (x/z)^2+3 (y/z)^2 = 7 $ and then $$ x^2+3 y^2 = 7z^2 \qquad (x,y) \in\mathbb Z, z \in \mathbb N^+ \tag 1 $$

Let $M= \begin{bmatrix} 8&0&3\\0&1&0\\21&0&8 \end{bmatrix}$ a transfer-matrix to recurse from one solution to another with constant $y$.
$\qquad \\ \\$

Beginning at $A_{1,0}=[2,1,1]=[x,y,z]$ we get the infinite set of solutions

$A_{1,0} \cdot M^i =A_{1,i} \qquad \qquad $ for i=-5..5

   i       x    y      z
 ...      ...   ...    ...
  -5   -331973  1    125474
  -4    -20830  1      7873
  -3     -1307  1       494
  -2       -82  1        31
  -1        -5  1         2
   0         2  1         1
   1        37  1        14
   2       590  1       223
   3      9403  1      3554
   4    149858  1     56641
   5   2388325  1    902702
  ...     ...   ...    ...

Sidenote: as you might observe, we have also another recursion inside the columns of $x_i$ and $z_i$ : $$x_{2+i}=16 x_{1+i} - 1 x_i$$

Now let's define a second matrix $Q= \begin{bmatrix} 4&0&-1\\0&3&0\\-7&0&4 \end{bmatrix} $

Using this matrix allows to shift from the set of solutions $A_{k,i}$ to $A_{3k,i}$ So $A_{1,0} \cdot Q = A_{3,0}$ which is numerically $[2,1,1] \cdot Q = [1,3,2]$ and

$A_{3,0} \cdot M^i =A_{3,i} \qquad \qquad $ for i=-5..5

   i       x    y      z
 ...      ...   ...    ...
  -5  -2206210  3   833869
  -4   -138431  3    52322
  -3     -8686  3     3283
  -2      -545  3      206
  -1       -34  3       13
   0         1  3        2
   1        50  3       19
   2       799  3      302
   3     12734  3     4813
   4    202945  3    76706
   5   3234386  3  1222483

This can analoguously be done with $y=9$ by ***$A_{3,0}\cdot Q=A_{9,0}$*** and the set of solutions $A_{9,i}=A_{9,i} \cdot M^i$ and so on to $y=3^m$. It might be nice to see a more complicate solution by one single matrix-equation: $$A_{81,3}= [2,1,1]\cdot Q^4 \cdot M^3 = [31627, 81, 11954]$$
I've not yet a method to get systematically all solutions; for instance there is a full tree of slutions with $y=19,3\cdot19,3^2\cdot19,3^3\cdot19,...$ beginning at $A_{19,0}=[10,19,13]$ using the same matrix-multiplications to define the full tree, then for $y=29 \cdot 3^k$ , $y=31 \cdot 3^k$ and so on.

General remark: because all $x,y,z$ occur as squares in the basic equation, we have always $\pm x$,$\pm y$ and $\pm z$ as valid solutions; however the matrix-formulae require meaningful attributing of signs.


There are only six solutions which are also algebraic integers, and they can each be found from whichever one you discover first.

For instance, $$(2 + \sqrt{-3}) \left( \frac{-1 + \sqrt{-3}}{2} \right) = \frac{-5 + \sqrt{-3}}{2}$$ and $$\frac{-5 + \sqrt{-3}}{2} \left( \frac{-1 + \sqrt{-3}}{2} \right) = \frac{1 - 3 \sqrt{-3}}{2}.$$

There are infinitely many solutions, but for each viable denominator $d$ there are only two or four solutions. For example, from the very strategically withheld solution $$\frac{10}{31} + \frac{47 \sqrt{-3}}{31}$$ (which was inexplicably deleted from this page earlier today) we can obtain $$\omega \left( \frac{10}{31} + \frac{47 \sqrt{-3}}{31} \right) = \frac{151 + 37 \sqrt{-3}}{62}$$ and verify that that number does have a norm of $7$.


Solving a Diophantine equation of the form $x^2 = ay^2 + byz + cz^2$ with the constants $a, b, c$ given and $x,y,z$ positive integers

The problem is solved definitely. Why is the question constantly recurs to me is not clear. Consider two options to solve this problem. The first option is to directly solve the equation without knowing whether there are solutions.


Solutions can be written if even a single root. $\sqrt{j(a+b+c)}$ , $\sqrt{b^2 + 4a(j-c)}$ , $\sqrt{b^2+4c(j-a)}$
Then the solution can be written.


$$+2(b+2c)(\sqrt{j(a+b+c)}\mp{j})sp+(j\mp \sqrt{j(a+b+c)})p^2$$




$$+2(b+2c) ( \sqrt{j(a+b+c)} \mp{j})sp + ( a + b + c \mp \sqrt{j(a+b+c)})p^2$$

In the case when the root $\sqrt{b^2+4c(j-a)}$ whole. Solutions have the form.






$$+2(4ac+b(2j-b)\pm {(b+2a)}\sqrt{b^2+4c(j-a)})sp+(b+2c\pm\sqrt{b^2+4c(j-a)})p^2$$

In the case when the root $\sqrt{b^2+4a(j-c)}$ whole. Solutions have the form.






$$+2((a+b+c)\sqrt{b^2+4a(j-c)}\mp{j(b+2a)})ps+ (b+2a\mp\sqrt{b^2+4a(j-c)})s^2$$

Since these formulas are written in general terms, require a certain specificity calculations.If, after a permutation of the coefficients, no root is not an integer. You need to check whether there is an equivalent quadratic form in which, at least one root of a whole. Is usually sufficient to make the substitution $X\longrightarrow{X+kY}$ or more $Y\longrightarrow{Y+kX}$ In fact, this reduces to determining the existence of solutions in certain Pell's equation. Of course with such an idea can solve more complex equations. If I will not disturb anybody, slowly formula will draw. number $p,s$ integers and set us. I understand that these formulas do not like. And when they draw - or try to ignore or delete. Formulas but there are no bad or good. They either are or they are not.

In equation $$aX^2+bY^2+cZ^2=qXY+dXZ+tYZ$$

$a,b,c,q,d,t - $ integer coefficients which specify the conditions of the problem. For a more compact notation, we introduce a replacement.

$$k=(q+t)^2-4b(a+c-d)$$ $$j=(d+t)^2-4c(a+b-q)$$ $$n=t(2a-t-d-q)+(2b-q)(2c-d)$$
Then the formula in the general form is:




$$+2((d+t-2c)\sqrt{k}\mp{ n })ps+(q+t+2(d-a-c)\pm\sqrt{k})s^2$$



And more.







$p,s - $ are integers and are given us. Since formulas are written in general terms, in the case where neither the root is not an integer, it is necessary to check whether there is such an equivalent quadratic form in which at least one root of a whole. If not, then the solution in integers of the equation have not.

Let's use this formula to solve this equation. For example use 2 formula.


$a=1 ; b= 0; c=3; j=7$










When considering a different root.


$a=3 ; b=0 ; c=1; j=7$

Use 3 formula.








  • $\begingroup$ The question constantly recurs because most answerers (not you, though) go into it with the attitude that they're going to demolish everyone else's answers. $\endgroup$
    – Lisa
    May 22, 2018 at 21:10
  • $\begingroup$ @Lisa they also have a pathological hatred for formulas. That only not write. Even write programs to search. Just not to write the formula. $\endgroup$
    – individ
    May 23, 2018 at 4:32
  • 1
    $\begingroup$ It's not the clearest of answers. Try just showing only what is asked. Or box the final/best answer. $\endgroup$ Jul 15, 2021 at 23:51

In general, solving such polynomial equations in rational indeterminates is somewhat easier than solving the corresponding Diophantine equations. To illustrate this statement, consider the following generalization of your equation over any field $K$ of characteristic $\neq 2$ : find all the solutions $x,y\in K$ of $x^2-by^2=c$ (*), with $ c\neq 0, b\in K$. It is straightforward that a solution $(x_0, y_0)$ exists if and only if $c$ is a norm from the extension $L=K(\sqrt b)$. Assuming this condition, how do we find all the solutions ? There are at least two methods:

  • the geometric method, as explained by Eric Wofsey, consists in the prametrization of the conic (*) obtained by intersecting it with a "pencil" of lines going through the point $(x_0, y_0)$

  • the algebraic method goes on exploiting the norm homomorphism $N:L^* \to K^*$ defined by $N(z)=x^2-by^2$ if $z=x+y\sqrt b$. It is clear that all solutions $z$ will be of the form $z=z_0u$ where $N(u)=1$, so the problem is equivalent to the determination of the kernel of the norm. Here $L/K$ is Galois, with Galois group $C_2$ generated by the "conjugation" $\sigma: \sqrt b \to -\sqrt b$, and Hilbert's thm. 90 (which holds for all cyclic extensions) states $N(u)=1$ if and only if $u$ is of the form $u = v / \sigma v, v\in L^*.$ All (easy) calculations done, we get $u$ of the form $$u=\frac {\alpha^2 + b \beta^2}{\alpha^2 - b \beta^2} + \frac{2 \alpha\beta}{\alpha^2 - b \beta^2} \sqrt b,$$ hence all the solutions $z=z_0u$. A good exercise would be to recover this formula using the geometric approach.

In your case, take $z_0=2+\sqrt{-3}$, but in general the main task is actually to find a solution $z_0$.

Complement 1. In order to allow comparison with other possible types of parametrizations, I carry the calculations through to the end in the problem at hand. It will be convenient to write $z=(x,y)$ for $z=x+y\sqrt{-3}$. In the formula giving $u$ above, $\alpha =0$ (resp. $\beta=0$) iff $u=-1$ (resp. $1$). Putting this case apart, the parametrization can be rewritten as $$u=(\frac {1-3t^2}{1+3t^2}, \frac {2t}{1+3t^2}), t\in \mathbf Q^*$$ Starting from the particular solution $z_0=(2,1)$, we get the family of all solutions $$z=z_0u=\epsilon (\frac {2+6t-6t^2}{1+3t^2},\frac {1+4t-3t^2}{1+3t^2}), \epsilon =\pm 1$$ Thus one recovers the geometric parametrization of AmateurMathPirate, and also the homogeneous prametrization given by -individ. It seems to me that the whole discussion "finite number vs. infinite number of solutions" originates from the assumption that an algebraic number of norm $1$ should be an algebraic unit. This is wrong : in a quadratic field for instance, a number of norm $\pm 1$ is a unit iff in addition its trace is a rational integer.

Complement 2. The general problem cannot be considered as settled without giving a criterion for the existence of a rational solution. A natural first step is to consider $y$ in $(*)$ as a rational parameter and, for a given $y$, check whether $\sqrt {c-by^2}$ is rational. This approach by trials and errors happens to work right away in the particular case here (and over any field of characteristic $\neq 2$), but if unlucky, one could as well waste a life time searching for a solution which does not exist ! Actually a general existence criterion is available over number fields thanks to Hasse's norm theorem in cyclic extensions. Equation (*) is equivalent to $c$ being a norm from $L=K(\sqrt b)$. Denote by $v$ any place of $K$, $w$ any place of $L$ above $v$ (archimedean or not). Hasse's theorem states that $c$ is a norm in $L/K$ iff $c$ is a norm in all the completions $L_w/K_v$. This is useful only if one has an effective criterion for the local normic conditions. For simplicity, let us examine only the case $K=\mathbf Q$. At the archimedean place, the condition is just a question of signs. At a non archimedean place, i.e. over a $p$-adic field $\mathbf Q_p$, it can be expressed in terms of the $p$ - Hilbert symbol <.,.> (with values in $(\pm 1)$), precisely it is equivalent to $<c,b>=1$. It remains to compute the Hilbert symbols. One must consider two separate preliminary cases (see e.g. Serre's "Local Fields", chap. XIV, §4):

  • the so-called "tame" case with $p$ odd : Write $c=p^{\gamma}c', b=p^{\beta}b'$, then $<c,b>=(-1)^{\frac {p-1}{2}\gamma\beta}(\frac {b'}{p})^{\gamma}(\frac {c'}{p})^{\beta}$, where $(\frac {*}{*})$ is the Legendre symbol

  • the so-called "wild" case with $p=2$ : Writing $U$ for the group of units of $\mathbf Q_2$, consider the homomorphisms $\epsilon , \omega : U \to {\mathbf Z}/2$ defined by $\epsilon (u)=\frac {u-1}{2}$ mod $2$ and $\omega (u)=\frac {u^2-1}{8}$ mod $2$. Then $<2,u>=(-1)^{\omega (u)}$ if $u \in U$ and $<u,v>=(-1)^{\epsilon (u)\epsilon (v)}$ if $u, v \in U$. Knowing that the $\mathbf F_2$ vector space $\mathbf Q_2^*/{\mathbf Q_2^*}^2$ has a basis consisting of the classes of $-1, 2, 5$, one can get $<c,b>$ from these special formulas

Note that all in all only finitetely many Hilbert symbols need to be computed, precisely for $p=2$ or $p$ dividing the discriminant of the original quadratic field ./.


@ The Short One

Allow me to disagree with your explanation. First, in expressing a solution to the problem under the form $z=x+y\sqrt -3 \in \mathbf Q(\sqrt -3)$ s.t. $N(z)=7$, why do you impose $z$ to be an algebraic integer ? The OP asked only for rational solutions $(x, y)$. Second, the numerical example which you give amounts to $N(z_0\omega)=N(z_0)$, which is obvious since the norm is multiplicative. The point is that there are infinitely many $u\in\mathbf Q(\sqrt -3)$ s.t. $N(u)=1$ apart from the units (= invertible elements of the ring of integers). Dirichlet's unit theorem gives the structure of the group of units $U_K$ of a number field $K$. In the particular case of an imaginary quadratic field, $U_K$ is finite, actually equal to the group $W_K$ of roots of unity contained in $K$. Here it happens that $W_K$ is of order $6$, consisting of $\pm$ the powers of $\omega$.

NB. What do you mean precisely by a "viable denominator" ?

At this point it seems necessary to give a detailed proof to convince you that there exists an infinite number of $u=x+y\sqrt b\in \mathbf Q (\sqrt b)$ s.t. $N(u)=1$ (here $b=-3$). Whether by a geometric approach (such as used by Eric Wofsey) or an algebraic one (via Hilbert's thm. 90), one has the parametrization : $x= \pm\frac {1+bt^2}{1-bt^2} , y=\pm\frac {2t}{1-bt^2}, t\in \mathbf Q^*$. It follows readily that $u'=u$ iff $t'= t$ and $(t'-t)(btt'-1)=0$, iff $t'=t$ or $bt^2=-1$ . This shows the announced property.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.