Enter any two values (A, B, Sum, or Product) into the calculator to determine the other values for a math “diamond problem.”

Diamond Problem Calculator

Diamond Problem Formula

In a standard math “diamond problem,” two numbers (A and B) are related to a sum and a product:

\begin{aligned}
S &= a + b \\
P &= ab \\
a,b &= \frac{S \pm \sqrt{S^2 - 4P}}{2}
\end{aligned}

Variables:

  • a and b are the two numbers in the diamond problem
  • S is their sum (S = a + b)
  • P is their product (P = ab)

To solve a diamond problem, you typically use S = a + b and P = ab. If you are given S and P, then a and b can be found by solving t² − S·t + P = 0 (which leads to (S ± √(S² − 4P)) / 2).

What is a Diamond Problem?

In math education, a diamond problem is a puzzle where two numbers go on the left and right sides of a diamond, their product goes on the top, and their sum goes on the bottom. You may be given the sum and product and asked to find the two side numbers.

Note: “Diamond problem” can also refer to a different concept in computer science (multiple inheritance ambiguity in object-oriented programming). This calculator and page refer to the math version.

How to Calculate Diamond Problem?

The following steps outline how to solve a Diamond Problem:


  1. Identify the given product (top) and sum (bottom) of the diamond.
  2. List factor pairs of the product.
  3. Choose the factor pair whose sum matches the given sum.
  4. Write that pair as the left and right sides of the diamond (order does not matter).

Example Problem:

Let's solve the following Diamond Problem:

Product: 24

Sum: 10

Step 1: Identify the given product (top) and sum (bottom).

Top (product): 24

Bottom (sum): 10

Step 2: List factor pairs of the product.

1 × 24 = 24, 2 × 12 = 24, 3 × 8 = 24, 4 × 6 = 24

Step 3: Find the factor pair that adds up to the sum.

4 × 6 = 24

4 + 6 = 10

Step 4: Write the two numbers as the left and right sides of the diamond.

4 | 6