1. ## Big-O notation question

hi guys,
can someone pls explain big-o notation to me in easy to understand way with an easy example?? I am trying to understand it by reading my textbook but i am not getting it at all. It uses the following example: show that f(x) = x^2 + 2x + 1 is O(x^2)

My first question is, what value of x do i start with?? i dont know how one chooses a value of x to start with. in the book, it starts with x > 1. I dont understand how they came up with 1 instead of 2, 3 or any other number.

if someone could please answer my question and also explain the big-o notation in an easy to understand way with an example, it would be great. thanks a lot in advance! i really appriciate it.

2. Originally Posted by bokasoka
hi guys,
can someone pls explain big-o notation to me in easy to understand way with an easy example?? I am trying to understand it by reading my textbook but i am not getting it at all. It uses the following example: show that f(x) = x^2 + 2x + 1 is O(x^2)

My first question is, what value of x do i start with?? i dont know how one chooses a value of x to start with. in the book, it starts with x > 1. I dont understand how they came up with 1 instead of 2, 3 or any other number.

if someone could please answer my question and also explain the big-o notation in an easy to understand way with an example, it would be great. thanks a lot in advance! i really appriciate it.
$\displaystyle f(x) \in O(g(x))$

means that for big enough $\displaystyle \displaystyle x$: $\displaystyle |f(x)|$ is less than (or equal) some fixed multiple of $\displaystyle \displaystyle g(x)$. This means that there exists an $\displaystyle x_0$ such that for all $\displaystyle x\ge x_0$, and a $\displaystyle k>0$:

$\displaystyle |f(x)|\le k g(x)$

In the case of your example for all $\displaystyle x \ge 1$ ; $\displaystyle x^2\ge x$ and $\displaystyle x^2 \ge 1$. Hence for all $\displaystyle x \ge 1$

$\displaystyle |f(x)|=f(x)=x^2+2x+1\le x^2+2x^2+x^2=4x^2$

Hence $\displaystyle f(x) \in O(x^2)$ (using $\displaystyle x_0=1,\ k=4$)

CB