# Big O notation, $1/(1-x)$ series

I am doing calculus and I find this notation extremely confusing even after reading textbook and notes.

Here is a question I was trying to do and I think I cannot do this yet because I dont fully understand what big O notation is...from all I know, big O notation basically says that a function $f(x)$ is less than a function $g(x)\cdot \text{constant}$. $g(x)$ is usually a variable from $f(x)$ that provides the maximum value around a certain point...so if $f(x)=2x^2+x^3$ around $0$ $g(x)$ would be $x^2$ and you would do $2x^2+x^2$ which gives $3x^2$ so our constant $O$ is $3$ and $g(x)$ is $x^2\ldots$

I think I am right on this?

Now I am totally stuck on this question below because I dont know how they are coming up with the numbers for $1/(1-x)$ or why they are using this...The solution of question is under but I dont really understand the question or the solution so can someone provide some clearance as to what is being asked and why the solution is what it is?  I want to do the rest myself without looking at solution so I need some help with this problem.

I know that since it says Maclaurin series that they are looking for big $O(g(x)$ around the point $x=0$.

Big $\mathcal{O}$ notation is a device useful in asymptotic analysis that helps us bound error terms in the approximations that we derive. More specifically, when you see an equation of the form:

$$\text{blah}=\text{stuff}+\mathcal{O}(\text{error})$$

the meaning is that $|\text{blah}-\text{stuff}|\le C\cdot\text{error}$ for some constant $C$. We have to be careful because, as this is asymptotic analysis, we're only claiming this inequality (for some constant) holds in some neighborhood of a region of interest. For example, if our analysis is as $x\to\infty$, we intend the error statement to hold in some neighborhood of infinity, or $(a,\infty)$ for some $a$, or if we look at $\to0^+$ we would mean that the error statement holds in an interval $(0,\epsilon)$ for some $\epsilon>0$.

Take the function $f(x)=1/(1-x)$ for example. This has the following Maclaurin series:

$$\color{Red}{\frac{1}{1-x}}= 1+x+x^2+x^3+\cdots=\color{Blue}{1+x+x^2}+\color{Purple}{x^3}\color{LimeGreen}{\big(1+x+\cdots\big)}.$$

Say we want to do analysis about the point $x=0$. In the interval $(-\frac{1}{2},\frac{1}{2})$ the part in green is no more than $f(1/2)=2$, so we can say that $\big|\color{Red}{f(x)}-\color{Blue}{1+x+x^2}\big|\le \color{LimeGreen}2\color{Purple}{x^3}$, or in Big-$\mathcal{O}$ notation,

$$\frac{1}{1-x}=1+x+x^2+\mathcal{O}(x^3).$$

Keep in mind this analysis applies only sufficiently close to the point $x=0$, so it doesn't apply to the singularity $x=1$ for example. As you hopefully can see, this is a tidy way to convey the asymptotic size of a remainder or leftover term in an approximation, such as a series expansion.

In these easier analyses (exercises with relatively simple and elementary functions), to find the expansion up to $\mathcal{O}(x^n)$ we simply write out the usual series expansion about the appropriate point, but truncate it at the $a_nx^n$ term and replace the deleted terms with a simple $\mathcal{O}(x^n)$.

Mathematicians love to abuse notation when it's convenient, so on top of what I've said so far you need to understand what it means to do operations with Big-$\mathcal{O}$ terms. One mentally helpful interpretation of any $\mathcal{O}(g(x))$ term is "some function bounded by $g$ up to a constant, but what it is specifically isn't important for my purposes or just at the moment." So when you see two $\mathcal{O}$ terms in an equation, you can just imagine the same interpretation for each separately, so there are two unknown error/leftover functions that are independent of each other but at least you're keeping track of how each is bounded in the region under consideration.

Consider, for example, $x^n\mathcal{O}(x^m)$: if $\text{error}(x)\le C x^m$ (our big-$\mathcal{O}$ is a placeholder for $\text{error}$), then we have $x^n\cdot\text{error}(x)\le C x^{n+m}$, which tells us we can just replace $x^n\mathcal{O}(x^m)$ with $\mathcal{O}(x^{n+m})$. Similar reasoning applies to the general term $f(x)\mathcal{O}(g(x))$. Exercise: roughly describe what the product of two $\mathcal{O}$ terms, i.e. $\mathcal{O}(f(x))\mathcal{O}(g(x))$, would mean to us, and find a single $\mathcal{O}$ term for $\mathcal{O}(x^n)\mathcal{O}(x^m)$.

Now if you were able to follow my answer you should be capable of following the explicit derivation given for $\rm5(a)$.

Two notes: in order to evaluate the series expansion of the function composition $f\circ g$, first write the expansion of $f(g)$ in the letter g, i.e. $a_0+a_1g+a_2g^2+\cdots$, and then replacing $g$ with its power series and taking powers where needed, then gathering up all the terms. You do not need to do this with the general, symbolic form of the terms, but rather truncate the expansions of $f$ and $g$ appropriately and work with a finite number of power and $\mathcal{O}$ terms (Exercise: figure out what "appropriately" means here).

Don't over-think it. When the question says "calculate the Maclaurin series of $f(x)$ up to $O(x^n)$" it just means "calculate the power series of $f(x)$ around $x=0$, including all terms with exponent less than $n$"

The best way to do this is to break the function down into parts that you already know the power series expression for. For example, when they ask you to calculate the series for $e^x/(1-x)$ You should recognize that this is $e^x$ multiplied by $1/(1-x)$. If you know the power series expressions for those functions (which you should) then you can find the power series of their product by multiplying the two power series together.

You have

$$e^x = 1 + x + \tfrac{1}{2}x^2 + O(x^3)$$

$$\frac{1}{1-x} = 1 + x + x^2 + O(x^3)$$

where the "$+ O(x^3)$" means that I've left out any terms with exponent 3 or higher. When reasoning informally, it's acceptable to just write

$$e^x = 1 + x + \tfrac{1}{2}x^2 + \cdots$$

$$\frac{1}{1-x} = 1 + x + x^2 + \cdots$$

You can then multiply these together:

\begin{align} \frac{e^x}{1-x} & = \left( 1 + x + \tfrac{1}{2} x^2 + \cdots \right) \left( 1 + x + x^2 + \cdots\right) \\ & = \left( 1 + x + x^2 + \cdots\right) + x \left( 1 + x + x^2 + \cdots\right) + \tfrac{1}{2} x^2 \left( 1 + x + x^2 + \cdots\right) \\ & = \left(1 + x + x^2 + \cdots\right) +\left( x + x^2 + \cdots\right) + \left(\tfrac{1}{2} x^2 + \cdots\right) \\ & = 1 + 2x + \tfrac{5}{2} x^2 + \cdots \end{align}

where all of the "$\cdots$" mean "here are some other terms that involve powers of $x$ with exponent greater than 3, that I'm not bothering to keep track of because I know they're not going to be involved in the final answer."

Essentially, when doing calculations of this kind and you only need terms up to (but not including) $O(x^n)$, it's always okay to drop terms like $x^n$, $x^{n+1}$ etc, because they can't feature in the final expression.

Caveat: If you are dividing by $x$ at any point, you might need to keep track of higher order terms, because their exponent will be reduced when you divide by a power of $x$. But you don't need to worry about that for your examples.