Big-O Addition Rule: Prove f1(n)+f2(n)=O(g1(n)+g2(n))f_1(n)+f_2(n)=O(g_1(n)+g_2(n))

Big-O Addition Rule: Prove f1(n)+f2(n)=O(g1(n)+g2(n))f_1(n)+f_2(n)=O(g_1(n)+g_2(n))

Verified Sources
Sep 14, 2026

We will prove a standard closure property of Big-O: if Big-O f1(n)=O(g1(n))f_1(n)=O(g_1(n)) and f2(n)=O(g2(n))f_2(n)=O(g_2(n)), then

f1(n)+f2(n)=O(g1(n)+g2(n)).f_1(n)+f_2(n)=O(g_1(n)+g_2(n)).

This proof relies directly on the definition of Big-O and a simple inequality manipulation:

f1(n)+f2(n)c1g1(n)+c2g2(n)max(c1,c2)(g1(n)+g2(n)).f_1(n)+f_2(n)\le c_1g_1(n)+c_2g_2(n)\le \max(c_1,c_2)\,(g_1(n)+g_2(n)).

To make the inequality step valid, we assume the usual conditions used with Big-O: g1(n)g_1(n) and g2(n)g_2(n) are nonnegative asymptotic functions for all nNn\ge N (or at least that g1(n)+g2(n)>0g_1(n)+g_2(n)>0 eventually), so g1(n)+g2(n)g_1(n)+g_2(n) can serve as an upper-bound scale. (These conditions are standard in algorithm analysis.)

Key terms used in this section: Big-O, asymptotic bound, eventually, nonnegative functions.

3

Footnotes

  1. Big O notation (Wikipedia) https://en.wikipedia.org/wiki/Big_O_notation - Defines Big-O via constants and “for sufficiently large nn”.

  2. Big O notation (math/CS context) https://en.wikipedia.org/wiki/Asymptotic_notations - Discusses formal definition and properties of asymptotic notation.

  3. Big O notation properties and manipulation https://en.wikipedia.org/wiki/Big_O_notation - Notes about algebraic manipulation and closure-like behaviors (with conditions).

Big-O definition and basic proof patterns

Formal Big-O proof for the sum

  1. 1
    Step 1

    From f1(n)=O(g1(n))f_1(n)=O(g_1(n)), there exist constants c1>0c_1>0 and N1N_1 such that for all nN1n\ge N_1, f1(n)c1g1(n)f_1(n)\le c_1 g_1(n). Similarly, from f2(n)=O(g2(n))f_2(n)=O(g_2(n)), there exist c2>0c_2>0 and N2N_2 such that for all nN2n\ge N_2, f2(n)c2g2(n)f_2(n)\le c_2 g_2(n). Big-O

  2. 2
    Step 2

    Let N=max(N1,N2)N=\max(N_1,N_2). Then for all nNn\ge N, both inequalities hold simultaneously.

  3. 3
    Step 3

    For all nNn\ge N, f1(n)+f2(n)c1g1(n)+c2g2(n).f_1(n)+f_2(n)\le c_1 g_1(n)+c_2 g_2(n).

  4. 4
    Step 4

    Let c=max(c1,c2)c=\max(c_1,c_2). Then cc1c\ge c_1 and cc2c\ge c_2, so c1g1(n)+c2g2(n)cg1(n)+cg2(n)=c(g1(n)+g2(n)).c_1 g_1(n)+c_2 g_2(n)\le c g_1(n)+c g_2(n)=c\,(g_1(n)+g_2(n)).

  5. 5
    Step 5

    We have shown that for all nNn\ge N, f1(n)+f2(n)c(g1(n)+g2(n)).f_1(n)+f_2(n)\le c\,(g_1(n)+g_2(n)). Therefore, f1(n)+f2(n)=O(g1(n)+g2(n))f_1(n)+f_2(n)=O(g_1(n)+g_2(n)) by the definition of Big-O.

Pro Tip: Use $c=\max(c_1,c_2)$

When you have two Big-O bounds f1c1g1f_1\le c_1 g_1 and f2c2g2f_2\le c_2 g_2, the cleanest way to combine them is to pick one constant that dominates both: c=max(c1,c2)c=\max(c_1,c_2).

Be careful about signs / eventual nonnegativity

The inequality c1g1(n)+c2g2(n)c(g1(n)+g2(n))c_1 g_1(n)+c_2 g_2(n)\le c(g_1(n)+g_2(n)) is straightforward if g1(n),g2(n)0g_1(n),g_2(n)\ge 0 eventually. If signs can change, you must adapt the argument (e.g., use absolute values or ensure g1+g2g_1+g_2 is eventually positive).

Why this works (intuition)

Big-O gives an eventual upper envelope: beyond some NN, each fif_i is no more than a constant multiple of its corresponding gig_i. Adding them preserves “upper envelope” behavior: the sum cannot grow faster than the sum of the envelopes (up to a constant factor).

This is a concrete instance of a more general closure property: if each term is bounded by a scaled reference function, then their combined expression is bounded by the combined reference function.

Key terms: closure property, upper bound, eventual inequality, constant factor.2

Footnotes

  1. Big O notation (math/CS context) https://en.wikipedia.org/wiki/Asymptotic_notations - Discusses formal definition and properties of asymptotic notation.

  2. Big O notation properties and manipulation https://en.wikipedia.org/wiki/Big_O_notation - Notes about algebraic manipulation and closure-like behaviors (with conditions).

Proof Roadmap (as you would teach it)

Unpack Big-O

Step A

Convert each OO statement into an explicit inequality with constants."

Choose a common $N$

Step B

Let N=max(N1,N2)N=\max(N_1,N_2) so both inequalities hold together."

Add and bound again

Step C

Add the inequalities and upper-bound coefficients using c=max(c1,c2)c=\max(c_1,c_2)."

Apply the definition

Step D

Conclude f1+f2=O(g1+g2)f_1+f_2=O(g_1+g_2)."

Common pitfalls and extensions

How the bound behaves

Big-O of the sum is controlled by the combined envelopes g1+g2g_1+g_2.

Knowledge Check

Question 1 of 4
Q1Single choice

Suppose f1(n)=O(g1(n))f_1(n)=O(g_1(n)) and f2(n)=O(g2(n))f_2(n)=O(g_2(n)). Which statement follows (under the standard eventual nonnegativity conditions)?