BRAGA

02 Writing02-02 Notes02-02-081

Sum of cubes

Published 16 Apr 202610 min read
Contents
  1. 01Deep Breakdown
  2. 02Flowchart
  3. 03Real-world use
  4. 04The formula, piece by piece
  5. 05The formula in words
  6. 06Critical Concepts
  7. 07Step-by-step calculation (tiny example)
  8. 08Code examples
a3+b3=(a+b)(a2−ab+b2)a^3 + b^3 = (a + b)(a^2 - ab + b^2)
(1)
latex
$a^3 + b^3 = (a + b)(a^2 - ab + b^2)$

Deep Breakdown

What it tells me (Situation Awareness): The sum of cubes a3+b3a^3 + b^3 factors into the product of a linear factor (a+b)(a+b) and a quadratic factor (a2−ab+b2)(a^2 - ab + b^2). The quadratic factor has a negative middle term −ab-ab and no real roots (its discriminant is (−b)2−4(1)(b2)=b2−4b2=−3b2<0(-b)^2 - 4(1)(b^2) = b^2 - 4b^2 = -3b^2 < 0 for b≠0b \ne 0). The only real root of a3+b3=0a^3 + b^3 = 0 is a=−ba = -b. This is the paired identity of the difference of cubes a3−b3=(a−b)(a2+ab+b2)a^3 - b^3 = (a-b)(a^2 + ab + b^2). The two are related by the SOAP mnemonic: Same sign as the original, Opposite middle term sign, Always Positive last term. In DA/DS, this identity appears in: simplifying rational expressions involving sums of cubes, computing limits of the form lim⁡x→−ax3+a3x+a=3a2\lim_{x \to -a} \frac{x^3 + a^3}{x + a} = 3a^2 (derivative of x3x^3 at x=−ax = -a from first principles), recognizing third-degree polynomial structure in gradient computations, and understanding why a3+b3≠(a+b)3a^3 + b^3 \ne (a+b)^3 (the cube of a sum expands to four terms; the sum of cubes is only two of them).

Flowchart

Expression: a³ +b³Factor: (a +b)(a² - ab + b²)Linear factor: (a+ b) — root at a= -bQuadratic factor:(a² - ab + b²) —no real rootsDiscriminant =b² - 4b² = -3b² <0 (for b ≠ 0)DA: simplify (x³+ a³)/(x + a) = x²- ax + a²Limit: lim_{a →-b} (a³+b³)/(a+b)= 3b² (derivativeat -b)SOAP: Same(+), Opposite(-ab), AlwaysPositive (+b²)CONTRAST:(a+b)³ = a³ +3a²b + 3ab² + b³≠ a³ + b³PAIRED: a³ - b³= (a-b)(a² + ab +b²) — middleterm flips to +

Real-world use

Where it is used

Simplifying rational expressions: x3+27x+3=(x+3)(x2−3x+9)x+3=x2−3x+9\frac{x^3 + 27}{x + 3} = \frac{(x+3)(x^2-3x+9)}{x+3} = x^2 - 3x + 9 (for x≠−3x \ne -3). Limit computations: lim⁡x→−ax3+a3x+a=3a2\lim_{x \to -a} \frac{x^3 + a^3}{x + a} = 3a^2 — derivative of f(x)=x3f(x) = x^3 at x=−ax = -a. Polynomial simplification in gradient derivations: ratios involving third-degree differences with sign changes.

Problem it solves

Without the identity, canceling (x+a)(x + a) from x3+a3x+a\frac{x^3 + a^3}{x + a} requires polynomial long division. The identity skips that and gives the quotient x2−ax+a2x^2 - ax + a^2 directly. This is particularly important for evaluating limits or simplifying expressions in gradient computations.

How it solves the problem

Verification by expansion: # (a+b)(a2−ab+b2)=a(a2−ab+b2)+b(a2−ab+b2)(a+b)(a^2 - ab + b^2) = a(a^2 - ab + b^2) + b(a^2 - ab + b^2)

=a3−a2b+ab2+a2b−ab2+b3=a3+b3= a^3 - a^2b + ab^2 + a^2b - ab^2 + b^3 = a^3 + b^3
(2)

. All middle terms cancel. The key is the alternating signs in the quadratic factor: −ab-ab ensures the a2ba^2b and ab2ab^2 cross terms cancel.

Example in a business

A data scientist is computing a finite-difference gradient approximation: f(w)−f(−1)w−(−1)=w3+1w+1\frac{f(w) - f(-1)}{w - (-1)} = \frac{w^3 + 1}{w + 1} for f(w)=w3f(w) = w^3. Using sum of cubes: w3+13=(w+1)(w2−w+1)w^3 + 1^3 = (w+1)(w^2 - w + 1) , so #w3+1w+1=w2−w+1\frac{w^3 + 1}{w+1} = w^2 - w + 1. At w=−1w = -1 the quotient =1+1+1=3=3(−1)2=f′(−1)= 1 + 1 + 1 = 3 = 3(-1)^2 = f'(-1). The identity avoids an undefined 0/00/0 form.

The formula, piece by piece

Breaking the notation:

  • a3+b3a^3 + b^3: sum of two cubes — requires recognizing both terms as perfect cubes (or expressible as cubes).
  • (a+b)(a + b): the linear factor — the same sign as the sum, zero when a=−ba = -b. Only real root.
  • (a2−ab+b2)(a^2 - ab + b^2): the irreducible quadratic factor — middle term is negative (Opposite from SOAP). Discriminant =−3b2<0= -3b^2 < 0 for b≠0b \ne 0, so no real roots. SOAP mnemonic (for both sum and difference of cubes):
  • Same: linear factor sign matches the original. a3+b3⇒(a+b)a^3 + b^3 \Rightarrow (a + b); a3−b3⇒(a−b)a^3 - b^3 \Rightarrow (a - b).
  • Opposite: middle term of quadratic has the opposite sign. Sum: −ab-ab; Difference: +ab+ab.
  • Always Positive: last term of quadratic is always +b2+b^2. Paired identity comparison:
  • Sum: a3+b3=(a+b)(a2−ab+b2)a^3 + b^3 = (a+b)(a^2 - ab + b^2) — middle term −ab-ab.
  • Difference: a3−b3=(a−b)(a2+ab+b2)a^3 - b^3 = (a-b)(a^2 + ab + b^2) — middle term +ab+ab. Limit application: lim⁡a→−ba3+b3a+b=lim⁡a→−b(a2−ab+b2)=b2+b2+b2=3b2\lim_{a \to -b} \frac{a^3 + b^3}{a + b} = \lim_{a \to -b}(a^2 - ab + b^2) = b^2 + b^2 + b^2 = 3b^2.

The formula in words

"To factor a3+b3a^3 + b^3: write (a+b)(a+b) times (a2−ab+b2)(a^2 - ab + b^2). Remember SOAP: the linear factor keeps the same sign; the middle term of the quadratic flips (here it's −ab-ab); the last term is always +b2+b^2. Verify by expanding — all middle terms cancel. The quadratic has no real roots. Compare with the difference of cubes, which has +ab+ab in the quadratic. In Python: sympy.factor(a**3 + b**3) returns this factoring."

Critical Concepts

  1. SOAP mnemonic: the single most reliable way to write both sum and difference of cubes correctly without confusion. Same sign for linear factor, Opposite sign for the middle term of the quadratic, Always Positive for the last term.
  2. Quadratic factor is irreducible: (a2−ab+b2)(a^2 - ab + b^2) has discriminant −3b2<0-3b^2 < 0 for b≠0b \ne 0. No real roots. The sum of cubes has only one real root over the reals: a=−ba = -b.
  3. Not the same as (a+b)3(a+b)^3: (a+b)3=a3+3a2b+3ab2+b3(a+b)^3 = a^3 + 3a^2b + 3ab^2 + b^3. The sum of cubes a3+b3a^3 + b^3 is missing 3a2b+3ab23a^2b + 3ab^2. This is the most common sign confusion: students try to "simplify" a3+b3a^3 + b^3 to (a+b)3(a+b)^3, which is wrong.
  4. Limit / derivative: a3+b3a+b=a2−ab+b2→3b2\frac{a^3 + b^3}{a + b} = a^2 - ab + b^2 \to 3b^2 as a→−ba \to -b. This gives the derivative of x3x^3 at x=−bx = -b: 3(−b)2=3b23(-b)^2 = 3b^2.
  5. Paired with difference of cubes: the two identities together cover all factoring of a3±b3a^3 \pm b^3.

The only structural difference is the sign of the middle term in the quadratic: sum of cubes has −ab-ab; difference of cubes has +ab+ab.

Step-by-step calculation (tiny example)

Task: simplify x3+64x+4\frac{x^3 + 64}{x + 4}.

Step 1: Recognize the form x3+64=x3+43x^3 + 64 = x^3 + 4^3. Sum of cubes: a=xa = x, b=4b = 4.

Step 2: Apply SOAP Linear factor: (a+b)=(x+4)(a + b) = (x + 4). Quadratic: a2−ab+b2=x2−4x+16a^2 - ab + b^2 = x^2 - 4x + 16.

Step 3: Factor x3+64=(x+4)(x2−4x+16)x^3 + 64 = (x + 4)(x^2 - 4x + 16).

Step 4: Cancel the common factor (x+4)(x2−4x+16)x+4=x2−4x+16\frac{(x+4)(x^2 - 4x + 16)}{x + 4} = x^2 - 4x + 16 (for x≠−4x \ne -4).

Step 5: Verify at x=2x = 2 (8+64)/(2+4)=72/6=12(8 + 64) / (2 + 4) = 72/6 = 12. Formula: 4−8+16=124 - 8 + 16 = 12.

Code examples

Beginner example (Python)

python
# Sum of cubes: a³ + b³ = (a + b)(a² - ab + b²)
# Basic verification
pairs = [(2, 1), (3, 2), (5, 3), (10, 7), (0.5, 0.25)]
print(f"{'a':>6} {'b':>6} {'a³+b³':>10} {'(a+b)(a²-ab+b²)':>18} {'match':>6}")
for a, b in pairs:
    lhs = a**3 + b**3
    rhs = (a + b) * (a**2 - a * b + b**2)
    print(f"{a:>6.2f} {b:>6.2f} {lhs:>10.4f} {rhs:>18.4f} {str(abs(lhs - rhs) < 1e-10):>6}")

# Simplify rational expression: (x³ + a³) / (x + a)
print("\nSimplification: (x³ + a³) / (x + a) = x² - ax + a²")
a_val = 4.0
for x in [1.0, 2.0, 5.0, 6.0]:
    if abs(x + a_val) > 1e-10:
        direct = (x**3 + a_val**3) / (x + a_val)
        factored = x**2 - a_val * x + a_val**2
        print(f" x={x:.1f}: direct={direct:.4f} factored={factored:.4f} match={abs(direct - factored) < 1e-10}")

# Derivative from first principles: d/dx(x³) at x = -2 = 3(-2)² = 12
a_limit = -2.0
print(f"\nDerivative of x³ at x={a_limit} via (x³+a³)/(x+a) → 3a² = {3*a_limit**2}")
for h in [0.1, 0.01, 0.001, 0.0001]:
    x_near = a_limit - h  # approaching -a from below
    if abs(x_near + a_limit) > 1e-12:
        diff_quot = (x_near**3 + a_limit**3) / (x_near + a_limit)
    else:
        diff_quot = float("nan")
    print(f" h={h:.4f} x+a={x_near + a_limit:.6f} quotient={diff_quot:.6f}")

# TRAP: a³ + b³ ≠ (a+b)³
a, b = 2.0, 3.0
print(f"\nTRAP: a³+b³ = {a**3 + b**3:.0f} vs (a+b)³ = {(a+b)**3:.0f}")

Beginner example (R)

r
# Sum of cubes in R: a³ + b³ = (a+b)(a² - ab + b²)
pairs <- list(c(2,1), c(3,2), c(5,3), c(10,7))
cat(sprintf("%-6s %-6s %-10s %-18s %s\n", "a", "b", "a³+b³", "(a+b)(a²-ab+b²)", "match"))
for (p in pairs) {
  a <- p[1]; b <- p[2]
  lhs <- a^3 + b^3
  rhs <- (a + b) * (a^2 - a*b + b^2)
  cat(sprintf("%-6.2f %-6.2f %-10.4f %-18.4f %s\n", a, b, lhs, rhs, abs(lhs - rhs) < 1e-10))
}

# Simplify (x³ + 64) / (x + 4)
a_val <- 4.0
cat(sprintf("\nSimplification: (x³ + %.0f³) / (x + %.0f) = x² - %.0fx + %.0f\n", a_val, a_val, a_val, a_val^2))
for (x in c(1, 2, 5, 6)) {
  direct <- (x^3 + a_val^3) / (x + a_val)
  factored <- x^2 - a_val * x + a_val^2
  cat(sprintf(" x=%d: direct=%.4f factored=%.4f match=%s\n", x, direct, factored, abs(direct - factored) < 1e-10))
}

Professional example (Python)

python
import numpy as np
import sympy as sp
import pandas as pd

# Scenario: symbolic and numeric verification of sum-of-cubes factoring
# Demonstrate SOAP mnemonic, limit at a = -b, and quadratic factor irreducibility

# Symbolic check
a, b, x = sp.symbols("a b x", real=True)
sum_cubes = a**3 + b**3
factored_sym = sp.factor(sum_cubes)
simplified_rat = sp.simplify(sum_cubes / (a + b))
limit_val = sp.limit((x**3 + b**3) / (x + b), x, -b)
print("Symbolic: sum of cubes")
print(f" Original: {sum_cubes}")
print(f" Factored: {factored_sym}")
print(f" (a³+b³)/(a+b) = {simplified_rat}")
print(f" Limit as a → -b: {limit_val} (= 3b²)")

# Numeric validation: (a³ + b³) / (a + b) ≈ 3b² near a = -b
b_vals = np.array([1.0, 2.0, 3.0, 5.0, 10.0])
delta = 1e-5
print("\nNumerical limit check: (a³+b³)/(a+b) → 3b² as a → -b")
print(f"{'b':>6} {'3b²':>8} {'ratio at a≈-b':>14} {'error':>10}")
for b_val in b_vals:
    a_near = -b_val + delta
    ratio = (a_near**3 + b_val**3) / (a_near + b_val)
    exact = 3 * b_val**2
    print(f"{b_val:>6.1f} {exact:>8.4f} {ratio:>14.6f} {abs(ratio - exact):>10.2e}")

# Discriminant of quadratic factor: -3b² < 0 for b ≠ 0
print("\nQuadratic factor a²-ab+b²: discriminant = -3b² < 0 (no real roots)")
for b_val in [1.0, 2.0, 5.0]:
    disc = b_val**2 - 4 * b_val**2  # coefficient of a: 1, constant: b²
    print(f" b={b_val}: discriminant = {disc:.2f} < 0: {disc < 0}")

Professional example (R)

r
# Numeric verification of sum-of-cubes: (a³+b³)/(a+b) and limit 3b² as a → -b
b_vals <- c(1, 2, 3, 5, 10)
delta <- 1e-5
cat("Numerical limit: (a³+b³)/(a+b) → 3b² as a → -b\n")
cat(sprintf("%6s %8s %14s %10s\n", "b", "3b²", "ratio at a≈-b", "error"))
for (b_val in b_vals) {
  a_near <- -b_val + delta
  ratio <- (a_near^3 + b_val^3) / (a_near + b_val)
  exact <- 3 * b_val^2
  cat(sprintf("%6.1f %8.4f %14.6f %10.2e\n", b_val, exact, ratio, abs(ratio - exact)))
}
cat("\nQuadratic factor a²-ab+b²: discriminant = -3b² < 0\n")
for (b_val in c(1, 2, 5)) {
  disc <- b_val^2 - 4 * b_val^2
  cat(sprintf(" b=%.1f: discriminant = %.2f < 0: %s\n", b_val, disc, disc < 0))
}

Source: 1300 p. 20

#algebra#algebra-and-factoring#factoring-and-product-formulas

Keyboard shortcuts

Single keys, ignored while typing in a field or with Cmd, Ctrl or Alt held.

0
Home
1 2 3 4
Work, Writing, Tools, About
j / k
Next / previous section on this page
n / p
Next / previous project or essay
u
Up one level
l
Deutsch
t
Light or dark theme
?
This list
Esc
Close