BRAGA

02 Writing02-02 Notes02-02-123

Addition/Subtraction Rule

Published 16 Apr 20267 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
lim⁡x→a[f(x)±g(x)]=lim⁡x→af(x)±lim⁡x→ag(x)\lim_{x \to a} [f(x) \pm g(x)] = \lim_{x \to a} f(x) \pm \lim_{x \to a} g(x)
(1)

Deep Breakdown

What it tells me (Situation Awareness): If both lim⁡x→af(x)\lim_{x \to a} f(x) and lim⁡x→ag(x)\lim_{x \to a} g(x) exist (are finite), then the limit of their sum or difference equals the sum or difference of their individual limits. This is one of the basic limit laws that make limits "well-behaved." It tells you that limits are linear: you can analyze the behavior of a combined function piece by piece, and then add/subtract the results. In DA/DS, this appears when analyzing the asymptotic behavior of algorithms composed of multiple terms — for example, the dominant term of O(n2+n)O(n^2 + n) as n→∞n \to \infty is determined by separating the components.

Flowchart

YesNo (at least one DNE orinfinite)Want: lim(x- a)of f(x) +/- g(x)Check: does limf(x) exist as x-a?Check: does limg(x) exist as x-a?Both limits exist(finite)?Apply rule:lim[f+/-g] = lim f+/- lim gRule does NOTapply directly --use othertechniquesEvaluate lim f(x)and lim g(x)separatelyCombine: add orsubtract theresults

Real-world use

Where it is used

Asymptotic complexity analysis (breaking O(n2+nlog⁡n)O(n^2 + n \log n) into components), analyzing convergence of combined terms in iterative algorithms, evaluating limits in gradient expressions, and understanding the long-run behavior of metrics that combine two separate sub-processes.

Problem it solves

Without this rule, evaluating lim⁡x→a[f(x)+g(x)]\lim_{x \to a} [f(x) + g(x)] would require analyzing the combined function from scratch. The rule lets you split the problem: evaluate each limit independently (often easier), then add. It also enables you to check whether each component converges before claiming the combined function converges.

How it solves the problem

The formal proof uses the ϵ\epsilon-δ\delta definition: given ϵ>0\epsilon > 0, if ∣f(x)−L∣<ϵ/2|f(x) - L| < \epsilon/2 and ∣g(x)−M∣<ϵ/2|g(x) - M| < \epsilon/2 for xx near aa, then ∣[f(x)+g(x)]−[L+M]∣≤∣f(x)−L∣+∣g(x)−M∣<ϵ|[f(x) + g(x)] - [L + M]| \leq |f(x) - L| + |g(x) - M| < \epsilon. The triangle inequality seals it.

Example in a business

Algorithm A has cost T(n)=3n2+5nT(n) = 3n^2 + 5n. As n→∞n \to \infty, analyze behavior by separating: lim⁡n→∞3n2=∞\lim_{n \to \infty} 3n^2 = \infty and lim⁡n→∞5n=∞\lim_{n \to \infty} 5n = \infty. Both diverge, so the combined limit diverges as well. To compare growth rates, divide by n2n^2: lim⁡n→∞(3+5/n)=3+0=3\lim_{n \to \infty} (3 + 5/n) = 3 + 0 = 3 (using the addition rule on 33 and 5/n5/n). The 5/n5/n term vanishes; the leading term dominates. Complexity is Θ(n2)\Theta(n^2).

The formula, piece by piece

  • lim⁡x→a\lim_{x \to a}: the limit as xx approaches aa (can be finite, +∞+\infty, or −∞-\infty)
  • f(x)f(x): first function
  • g(x)g(x): second function
  • L=lim⁡x→af(x)L = \lim_{x \to a} f(x): the limit of ff (must exist and be finite)
  • M=lim⁡x→ag(x)M = \lim_{x \to a} g(x): the limit of gg (must exist and be finite) Full rule: lim⁡x→a[f(x)±g(x)]=lim⁡x→af(x)±lim⁡x→ag(x)=L±M\lim_{x \to a} [f(x) \pm g(x)] = \lim_{x \to a} f(x) \pm \lim_{x \to a} g(x) = L \pm M Required condition: both LL and MM must exist (be finite real numbers).

If either is ±∞\pm\infty, some cases work (e.g., ∞+2=∞\infty + 2 = \infty) but ∞−∞\infty - \infty is indeterminate.

The formula in words

"The limit of a sum (or difference) equals the sum (or difference) of the individual limits, as long as both individual limits exist." lim⁡x→2(x2+3x)=lim⁡x→2x2+lim⁡x→23x=4+6=10\lim_{x \to 2} (x^2 + 3x) = \lim_{x \to 2} x^2 + \lim_{x \to 2} 3x = 4 + 6 = 10.

Critical Concepts

  • Both limits must exist. The rule fails if either limit is undefined. lim⁡x→0[sin⁡(1/x)+sin⁡(1/x)]\lim_{x \to 0} [\sin(1/x) + \sin(1/x)] cannot be split because lim⁡x→0sin⁡(1/x)\lim_{x \to 0} \sin(1/x) does not exist.
  • ∞−∞\infty - \infty is indeterminate. If both limits are infinite and you subtract, the result is not determined — this is one of the seven indeterminate forms, requiring L'Hôpital or algebraic manipulation.
  • Extends to any finite number of terms: lim⁡[f+g+h]=lim⁡f+lim⁡g+lim⁡h\lim [f + g + h] = \lim f + \lim g + \lim h, applied twice.
  • This is linearity: lim⁡[cf+dg]=clim⁡f+dlim⁡g\lim [cf + dg] = c \lim f + d \lim g for constants c,dc, d.
  • Basis for polynomial limits: lim⁡x→a(anxn+⋯+a0)=anan+⋯+a0\lim_{x \to a} (a_n x^n + \cdots + a_0) = a_n a^n + \cdots + a_0 — split each term, use constant extraction.

Step-by-step calculation (tiny example)

Step 1: Identify the two component functions and the limiting point Evaluate lim⁡x→3(x2−2x)\lim_{x \to 3} (x^2 - 2x). Components: f(x)=x2f(x) = x^2, g(x)=2xg(x) = 2x, limit point a=3a = 3.

Step 2: Compute each limit separately lim⁡x→3x2=32=9\lim_{x \to 3} x^2 = 3^2 = 9. lim⁡x→32x=2(3)=6\lim_{x \to 3} 2x = 2(3) = 6.

Step 3: Combine via the addition/subtraction rule lim⁡x→3(x2−2x)=9−6=3\lim_{x \to 3} (x^2 - 2x) = 9 - 6 = 3. Verify: f(3)=9−6=3f(3) = 9 - 6 = 3 (the function is continuous, so the limit equals the function value here). Confirmed.

Code examples

Beginner example (Python)

python
import numpy as np

# Limit addition rule: lim[f(x) + g(x)] = lim f(x) + lim g(x)
# Verify numerically by approaching a = 3


def f(x: np.ndarray) -> np.ndarray:
    return x ** 2


def g(x: np.ndarray) -> np.ndarray:
    return 2 * x


TARGET_A = 3.0
epsilons = [0.1, 0.01, 0.001, 0.0001]
print("Numerical verification: lim(x->3) [x^2 - 2x] = lim x^2 - lim 2x = 9 - 6 = 3")
print()
print(f"{'epsilon':>12} | {'f(a+eps)':>12} | {'g(a+eps)':>12} | {'f-g at a+eps':>14} | {'combined':>12}")
print("-" * 70)
for eps in epsilons:
    x_val = TARGET_A + eps
    combined = f(x_val) - g(x_val)
    print(f"{eps:>12.4f} | {f(x_val):>12.6f} | {g(x_val):>12.6f} | {combined:>14.8f} | {f(x_val)-g(x_val):>12.8f}")

# Expected limits
lim_f = TARGET_A ** 2
lim_g = 2 * TARGET_A
print(f"\nlim f = {lim_f}, lim g = {lim_g}, lim f - lim g = {lim_f - lim_g}")
print("As epsilon shrinks to 0, f(a+eps) - g(a+eps) -> 3 from above. Rule confirmed.")

Beginner example (R)

r
# Limit addition rule: lim[f(x) + g(x)] = lim f(x) + lim g(x)
f <- function(x) x^2
g <- function(x) 2 * x
TARGET_A <- 3
epsilons <- c(0.1, 0.01, 0.001, 0.0001)
cat(sprintf("Approaching x = %g from above: f(x) - g(x) -> f(a) - g(a)\n\n", TARGET_A))
cat(sprintf("%12s | %12s | %12s | %14s\n", "epsilon", "f(a+eps)", "g(a+eps)", "f-g at a+eps"))
cat(strrep("-", 55), "\n")
for (eps in epsilons) {
  x_val <- TARGET_A + eps
  cat(sprintf("%12.4f | %12.6f | %12.6f | %14.8f\n", eps, f(x_val), g(x_val), f(x_val) - g(x_val)))
}
cat(sprintf("\nlim f = %.1f, lim g = %.1f, lim(f-g) = %.1f\n", f(TARGET_A), g(TARGET_A), f(TARGET_A)-g(TARGET_A)))

Professional example (Python)

python
import numpy as np
import pandas as pd

# Scenario: asymptotic complexity analysis for two competing algorithm implementations
# T1(n) = 2n^2 + n (naive implementation)
# T2(n) = 3n + 100 (linear implementation)
# Analyze component behavior as n -> inf by splitting limits
n_values = np.array([10, 50, 100, 500, 1000, 5000, 10000])
results = []
for n in n_values:
    # T1 components: 2n^2 and n
    t1_quadratic = 2 * n**2
    t1_linear = n
    t1_total = t1_quadratic + t1_linear

    # T2 components: 3n and 100
    t2_linear = 3 * n
    t2_constant = 100
    t2_total = t2_linear + t2_constant

    # Ratio T1/T2: does T2 scale better?
    ratio = t1_total / t2_total
    results.append({
        "n": n,
        "T1_total": t1_total,
        "T2_total": t2_total,
        "ratio_T1_T2": round(ratio, 2),
        # lim(T1/n^2) as n->inf: split numerator, divide by n^2
        # (2n^2 + n)/n^2 = 2 + 1/n -> 2 + 0 = 2 by addition rule
        "T1_per_n2": round(t1_total / n**2, 6),
    })
df = pd.DataFrame(results)
print("Asymptotic Analysis: Limit Addition Rule on Algorithm Complexity")
print("T1(n) = 2n^2 + n | T2(n) = 3n + 100")
print("lim T1(n)/n^2 = lim(2 + 1/n) = lim 2 + lim 1/n = 2 + 0 = 2 (addition rule)")
print()
print(df.to_string(index=False))
print("\nT1_per_n2 -> 2.0 as n grows: confirms T1 is Theta(n^2), leading coefficient = 2.")
print("T2 is Theta(n), so T1 dominates: ratio T1/T2 grows without bound.")

Professional example (R)

r
# lim T1(n)/n^2 = lim(2 + 1/n) = 2 (addition rule)
n <- c(10, 100, 1000, 10000)
T1 <- 2*n^2 + n
T2 <- 3*n + 100
T1_per_n2 <- T1 / n^2
results <- data.frame(n = n, T1 = T1, T2 = T2, T1_per_n2 = T1_per_n2)
cat("Limit addition: T1(n)/n^2 -> 2\n")
print(results)
cat("T1 is Theta(n^2), T2 is Theta(n).\n")

Source: AIO p. 44

#algebra#summation-and-limit-manipulations#limits

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