I was thinking about the third scenario described in al-Khowarizmi’s al-Jabr: \(x^2 = 3x + 4\). I was curious about the integer solutions of the general pattern, \(x^2 = ax + b\).

It’s easy enough to demonstrate that this will hold if \(x = b = a + 1\), since that means \((a + 1)^2 = a^2 + 2a + 1\) and \(a(a + 1) + (a + 1) = a^2 + a + a + 1 = a^2 + 2a + 1\). But for what other parameters will it hold?

I was also intrigued to notice that the right hand side of this equation is a line, while the left hand side is a parabola. Algebraically, this means that there are either zero, one, or two solutions, depending on the values of the parameters (\(a\) and \(b\)). However, because al-Khowarizmi limited himself to only positive values for the parameters and the solution, that means each set of those values provides exactly one solution. This is because the right hand side will represent a line with a positive slope crossing the y-axis above the origin; as a result, there will always be one positive and one negative solution.

So, more formally: Determine all \((a, b) \in \mathbb{N}^* | x^2 = ax + b \Rightarrow x \in \mathbb{N}^*\).

Let \(x = (a + c)\). Since \(a\) and \(x\) are positive integers, \(c > -a\) and is an integer; we’ll prove later that \(c > 0\) (that is, that \(c \in \mathbb{N}^*\)).

\(x = (a + c) \Rightarrow \\ (a + c)^2 = a(a + c) + b \Rightarrow \\ a^2 + 2ac + c^2 = a^2 + ac + b \Rightarrow \\ ac + c^2 = b\)

Hence, there will be a positive solution when \(b = c(a + c)\). If \(-a < c \le 0\), \(b \le 0\), so \(c\) has to be a positive integer as well. Remember, meanwhile, that \(x = a + c\). This allows us to generate a solution for all positive integers \(a\) and \(c\). For instance, when \(a = 5\) and \(c = 9\), \(b = 9(5 + 9) = 126\) and \(x^2 = 5x + 126\) has a solution \(x = 14\).

This also means that we can predict how many such sets have a solution \(x = n\), specifically, \(n – 1\). For instance, if we want a solution of \(x = 5\), we can use: \((a, c) \in \{(1, 4), (2, 3), (3, 2), (4, 1)\}\), that is, \((a, b) \in \{(1, 20), (2, 15), (3, 10), (4, 5)\}\): \[x^2 = x + 20 \\ x^2 = 2x + 15 \\ x^2 = 3x + 10 \\ x^2 = 4x + 5\]

This pattern suggests another way of approaching our original solution. Since \(ax\) and \(x^2\) are multiples of \(x\), it must also be the case that \(b\) is a multiple of \(x\). Let’s say \(b = cx\). Then \(x^2 = x \cdot x= ax + cx = (a + c)x\), so \(x = a + c\).