Diamond Problem Calculator

Diamond Problem Calculator

Growing AI Skill PRO

Enter Calculation

Formula

a,b=Sum (S)±Sum (S)2−4Product (P)2a,\,b = \frac{\text{Sum (S)} \pm \sqrt{\text{Sum (S)}^{2} - 4\,\text{Product (P)}}}{2}
Usage stats

Advertisement

Results

The two numbers are
4  and  3
Value a 4
Value b 3
Discriminant (S² − 4P) 1

Report an error on this page

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).

Advertisement
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)\).

Advertisement

Interpreting the Discriminant and Sign Patterns

What the discriminant tells you

  • \(\Delta>0\): two distinct real numbers \(a\neq b\) exist.
  • \(\Delta=0\): the numbers are equal, \(a=b=\frac{S}{2}\) (a repeated number). For example, \(P=9\) and \(S=6\) give \(a=b=3\).
  • \(\Delta<0\): no real pair exists. The numbers are complex conjugates, \(\frac{S}{2}\pm i\frac{\sqrt{-\Delta}}{2}\).

Sign rules

Condition Meaning for the two numbers
\(P>0\) and \(S>0\) Both numbers are positive.
\(P>0\) and \(S<0\) Both numbers are negative.
\(P<0\) One number is positive and one is negative. The number with the larger absolute value has the same sign as \(S\).
\(P=0\) One number is 0 and the other equals \(S\).

For example, with \(P=-10\) and \(S=3\), the numbers are 5 and -2. The larger absolute value, 5, is positive, which matches the sign of \(S=3\).

Perfect-square discriminants and factoring

When \(S\) and \(P\) are integers and \(\Delta\) is a perfect square, the two numbers are integers. In that case the trinomial factors nicely over the integers. If \(\Delta\) is positive but not a perfect square, the numbers are irrational and the trinomial does not factor over the integers. If \(\Delta<0\), it does not factor over the real numbers.

The diamond problem is the same as factoring a monic trinomial:

$$x^2+Sx+P=(x+a)(x+b),\quad a+b=S,\; a\cdot b=P.$$

For example, \(x^2+3x-10\) has \(S=3\) and \(P=-10\), giving \(a=5\) and \(b=-2\), so it factors as \((x+5)(x-2)\).

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:

Most popular in Math and Statistics

View all Math and Statistics calculators