Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

The two numbers are
4  and  3
a + b = Sum, a × b = Product
Value a 4
Value b 3
Discriminant (S² − 4P) 1

What Is the Diamond Problem?

The diamond problem is a classic algebra exercise often used when learning to factor quadratic trinomials. A diamond shape holds a product (P) at the top and a sum (S) at the bottom. Your job is to find the two side numbers, a and b, that multiply to give P and add to give S. This calculator solves that puzzle instantly.

Diamond shape divided into four quadrants with product on top, sum on bottom, and two empty side cells
The classic diamond layout: product on top, sum on bottom, the two unknown numbers on the sides.

How to Use It

Enter the product P (the top number) and the sum S (the bottom number), then read off the two numbers a and b. The tool also reports the discriminant so you can tell when no real pair exists.

The Formula Explained

The two numbers are the roots of the quadratic \(x^2 - Sx + P = 0\). By the quadratic formula:

$$a,\,b = \frac{S \pm \sqrt{S^2 - 4P}}{2}$$

The expression under the root, \(\Delta = S^2 - 4P\), is the discriminant. If \(\Delta \ge 0\) the two numbers are real; if \(\Delta < 0\) there is no real solution (the numbers are complex).

Diagram linking the diamond cells to the quadratic formula with discriminant highlighted
The side numbers come from the quadratic formula using S and P, with the discriminant S squared minus 4P.

Worked Example

Suppose the product is 12 and the sum is 7. Then $$\Delta = 7^2 - 4 \cdot 12 = 49 - 48 = 1,$$ and \(\sqrt{1} = 1\). So \(a = (7 + 1)/2 = 4\) and \(b = (7 - 1)/2 = 3\). Indeed \(4 \times 3 = 12\) and \(4 + 3 = 7\). The factored form is \((x + 3)(x + 4)\).

FAQ

Why might there be no solution? If \(S^2 < 4P\), the discriminant is negative and no two real numbers can satisfy both conditions.

Can the numbers be negative or decimals? Yes — the calculator handles any real inputs, including negative products and non-integer results.

Are a and b interchangeable? Yes. The order does not matter since both \(a+b\) and \(a \cdot b\) are symmetric.

Last updated: