Math calculator

Diamond Problem Calculator

Any two cells give the other two — and when no pair exists, that is the answer.

Fill in the diamond

Any two cells determine the other two. Leave the rest blank.

product 12, sum 7

3 and 4

Both whole numbers, which is what a worksheet expects.

Product (top)

12

left × right

Sum (bottom)

7

left + right

S² − 4P

1

a perfect square — whole or fractional answers

Factors

(x − 3)(x − 4)

x² − 7x + 12

How it was worked out

  1. Write the quadratic the two numbers satisfy. Two numbers with sum 7 and product 12 are the roots of t² − 7t + 12 = 0.
  2. Check the discriminant. S² − 4P = (7)² − 4(12) = 1
  3. Solve. t = (7 ± √1) / 2, giving 3 and 4.

This diamond is the AC step for any trinomial with a·c = 12 and b = 7 — x² + 7x + 12 being the simplest of them. Finding the pair is the entire difficulty of factoring by grouping; the rest is bookkeeping.

The two numbers multiply to 12 and add to 7, checked from the answers rather than assumed.

What this tool shows

Any two cells give the other two — and the product-and-sum case is a quadratic, which is why guessing runs out.

  • Any two cells given, with the other two derived
  • The product-and-sum case solved as a quadratic rather than guessed
  • Diamonds with no real solution reported, with the closest achievable product
  • The AC-method connection written out for your own numbers
All four given/unknown cases Exact, including fractions Impossible diamonds named Free, no signup

Free, no signup — impossible diamonds reported, not rounded.

Updated 6 September 2026 · Works in any browser, no installation

Two numbers with a given product and sum are the roots of t² − St + P = 0. For a product of 12 and a sum of 7 that gives 3 and 4, which is also the factorisation (x − 3)(x − 4).

At a glance

Formula shown
Two numbers with product P and sum S are the roots of t\u00b2 \u2212 St + P = 0. They exist over the reals exactly when S\u00b2 \u2212 4P \u2265 0.
Scenario support
Any two of the four cells, with rational values.
Educational estimate
Planning support from the values you enter — not professional advice.

Four cells, and four different problems

The picture is always the same and the work is not. Which two cells you are given decides whether the problem is one multiplication or a quadratic:

  • Both numbers. Multiply and add. left 3, right −5 gives a product of −15 and a sum of −2. No thinking required.
  • The product and one number. Divide, then add. One step each.
  • The sum and one number. Subtract, then multiply.
  • The product and the sum. A quadratic — and this is the one worksheets actually ask.

Only the last case has any difficulty in it, and the difficulty is real: there is no direct formula that produces the pair, because finding it is exactly as hard as solving a quadratic. That is why guessing works on easy diamonds and fails on the rest.

Why product-and-sum is a quadratic

If the two numbers are r and s with r + s = S and rs = P, then r and s are the roots of (t − r)(t − s) = t² − St + P. That is a complete derivation, and it is why the diamond and the quadratic are the same problem in two costumes.

product 12, sum 7 gives t² − 7t + 12 = 0 with discriminant 1, a perfect square, so both roots come out whole: 3 and 4.

product −24, sum 2 works the same way and produces −4 and 6. A negative product means the two numbers straddle zero — one positive, one negative — which is a useful thing to read off before doing any arithmetic at all.

When no such pair exists

product 6, sum 1 has no solution over the reals. S² − 4P = −23, which is negative, and that is not a hint that the pair is hard to spot — it is a proof that no two real numbers have that sum and that product.

The reason is a bound worth knowing: for a fixed sum S, the largest possible product is S²/4, reached when the two numbers are equal. Ask for anything larger and you are asking for something arithmetic cannot supply.

A calculator that returns a rounded near-miss here has answered a different question. The tool reports the impossibility and gives the closest achievable product for that sum, which at least says how far off the request was.

Irrational answers are still answers

product 1, sum 3 does have a real solution — S² − 4P = 5, positive — but it is not a perfect square, so the two numbers are (3 − √5)/2 and (3 + √5)/2.

Those are exact. Written as decimals they are 0.3819660113 and 2.618033989, and multiplying those decimals will not give exactly 1 — which is why the surd form is the one to keep.

In a factoring context this is the signal that the trinomial does not factor over the integers. A worksheet asking for whole numbers has no answer here, and the honest response is to say so rather than to round to the nearest pair that looks plausible.

The diamond IS the AC method

To factor ax² + bx + c by grouping you look for two numbers whose product is a×c and whose sum is b. That is a diamond, and the whole difficulty of factoring by grouping lives in it — the splitting and grouping that follow are bookkeeping.

This diamond is the AC step for any trinomial with a·c = 12 and b = 7 — x² + 7x + 12 being the simplest of them. Finding the pair is the entire difficulty of factoring by grouping; the rest is bookkeeping.

Which is why an impossible diamond and an unfactorable trinomial are the same fact. If no two integers have product ac and sum b, the trinomial does not factor over the integers, and the discriminant of the diamond is the discriminant of the trinomial. The Factoring Trinomials Calculator runs the full search with every factor pair listed.

Reading the signs before doing the arithmetic

The signs of the two cells narrow the answer before any calculation:

  • Product positive, sum positive — both numbers positive.
  • Product positive, sum negative — both negative. product −30, sum −1 is close to this shape.
  • Product negative — one of each sign, whatever the sum does. The sum then tells you which of the two is bigger in size: a positive sum means the positive number is.

product −24, sum 2 has a negative product, so one number is negative: −4 and 6. The sum being positive says the positive one is larger in magnitude, which it is.

This is worth doing first because it halves the search space for free, and because it catches sign errors after the fact — a pair that multiplies to a negative and that you have written as two positives is wrong before you check anything else.

Sources and methodology

The diamond is a teaching device rather than a named theorem; what it rests on is the relationship between the roots and coefficients of a quadratic, stated below.

Method. Every figure on this page comes from src/lib/diamond-problem.ts, which routes the product-and-sum case through the exact quadratic solver in src/lib/algebra/quadratic.ts. The discriminant is an exact rational, so "no real solution" and "irrational solution" are decided rather than estimated — a distinction a floating-point discriminant near zero cannot always make. That engine is verified on every change against 51 hand-written assertions, including that the two returned numbers always multiply and add back to the given cells, and that a negative discriminant is reported as impossible rather than solved. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Factoring TrinomialsFactor a trinomial by the AC method with every factor pair of ac listed, the common factor taken out first, and the answer multiplied back out to check it.
Quadratic FormulaSolve any quadratic with exact roots — surds stay surds and a negative discriminant gives the complex pair — plus the vertex, the factored form and every step of the working.
Perfect Square TrinomialTest whether a trinomial is a perfect square against all three conditions, name which one failed, and give the constant that would fix it — plus the difference-of-squares answer when that is what you actually have.
FOILMultiply two binomials with all four products named — First, Outer, Inner, Last — shown as a grid too, with difference of squares and perfect squares recognised.
Completing the SquareRewrite ax² + bx + c as a(x − h)² + k with every step shown, solve by the method, or find the constant that completes a square — all in exact fractions.
DiscriminantEvaluate b² − 4ac, the cubic and quartic discriminants, or D = f_xx·f_yy − (f_xy)² for the second-derivative test, in exact arithmetic so the sign is never a rounding artefact.

More in Math, or browse all calculators.

Read the guide

The diamond is one step inside a larger method. Which Method Should You Use to Solve a Quadratic? covers when factoring by grouping is the fast route and when completing the square or the formula beats it outright.

Educational use disclaimer

This calculator solves the four-cell diamond used in algebra courses, exactly, over the rationals. When only the product and the sum are given the two numbers are the roots of a quadratic, and they may be irrational or may not exist at all over the reals — both cases are reported as such rather than approximated to a plausible pair.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 6 September 2026

  1. Published the diamond problem page: all four given/unknown cases, including the product-and-sum case that is really a quadratic.
  2. An impossible diamond — where S² − 4P is negative — is reported as impossible, with the closest achievable product for that sum, rather than rounded to a near miss.
  3. Names the AC-method connection explicitly, since the diamond is that step of factoring by grouping rather than a puzzle of its own.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.