Show that $0\leq c_1n^2\leq an^2+bn+c \leq c_2 n^2$ for all $n\geq n_0.$

47 Views Asked by At

Currently I am reading Introduction to Algorithm. At page $46,$ the author mentions the following.

Let $f(n) = an^2+bn+c$ where $a>0.$ If $c_1 = \frac{a}{4}, c_2 = \frac{7a}{4}$ and $n_0 = 2\max \{\frac{|b|}{a}, \sqrt{\frac{|c|}{a}} \},$ then one may verify that $$0\leq c_1n^2\leq an^2+bn+c \leq c_2 n^2 \quad \text{for all } n\geq n_0.$$

I am not able to verify the above inequalities.

For example, we would like to have $$c_1 n^2 \leq an^2+bn+c,$$ which is equivalent to $$0 \leq \frac{3an^2}{4} + bn + c.$$ But I do not know how to apply the fact that $n\geq 2 \max \{\frac{|b|}{a}, \sqrt{\frac{|c|}{a}} \}.$

Any hint is appreciated.

2

There are 2 best solutions below

3
On

You are given a quadratic function and several related constants of

$$f(n) = an^2+bn+c, \; a \gt 0 \tag{1}\label{eq1}$$

$$c_1 = \frac{a}{4}, \; c_2 = \frac{7a}{4} \tag{2}\label{eq2}$$

$$n_0 = 2\max \left\{\frac{|b|}{a}, \sqrt{\frac{|c|}{a}} \right\} \tag{3}\label{eq3}$$

You're asked to verify that

$$0 \leq c_1n^2 \leq an^2 + bn + c \leq c_2n^2 \quad \text{for all } n \geq n_0 \tag{4}\label{eq4}$$

Since $c_1 \gt 0$, then the first part of \eqref{eq4}, i.e., $0 \le c_1n^2$, is quite obviously true. The next part is to show that

$$c_1n^2 \le an^2 + bn + c \implies 0 \le \frac{3an^2}{4} + bn + c \tag{5}\label{eq5}$$

as you've already noted. I will show \eqref{eq5} holds for all $n \geq n_0$ using $2$ basic steps: confirm it holds at $n_0$, and the RHS never becomes less than $0$ for any later value. For the second step, there are $2$ main ways I'm aware of doing this: determine the derivative of the RHS is always non-negative for $n \geq n_0$, or use the quadratic formula to show there are no roots, the roots are all less than $n_0$, or there is a repeated root at or after $n_0$. To help keep this answer somewhat simpler, and since I believe you know how to use derivatives, I'll just use the derivative method here. This gives

$$g(n) = \frac{3an}{2} + b \; \text{ and } \; g'(n) = \frac{3a}{2} \tag{6}\label{eq6}$$

Since $a \ge 0$, \eqref{eq6} is an increasing function, as indicated by $g'(n) \gt 0$, so if you can show it's non-negative at $n = n_0$, it'll always be non-negative for all $n \ge n_0$, so the original function will always be non-decreasing and, thus, non-negative if it starts that way.

From \eqref{eq3}, there are $2$ cases to consider based on which value inside the curly brackets is larger. First, consider

$$\frac{|b|}{a} \ge \sqrt{\frac{|c|}{a}} \tag{7}\label{eq7}$$

so $n_0 = \frac{2|b|}{a}$. The RHS of \eqref{eq5} for $n = n_0$ becomes

$$\begin{equation}\begin{aligned} \frac{3an^2}{4} + bn + c & = \frac{3a(4b^2)}{4a^2} + \frac{2b|b|}{a} + c \\ & = \frac{3b^2}{a} + \frac{2b|b|}{a} + c \\ & \ge \frac{b^2}{a} + c \end{aligned}\end{equation}\tag{8}\label{eq8}$$

The last step comes from $\frac{2b|b|}{a} >= -\frac{2b^2}{a}$, with equality if $b \le 0$. Next, as both values in \eqref{eq7} are non-negative, you can square both sides and keep the same inequality, so doing this & some manipulations gives

$$\begin{equation}\begin{aligned} \frac{b^2}{a^2} \ge \frac{|c|}{a} \\ \frac{b^2}{a} \ge |c| \\ \frac{b^2}{a} \ge -c \\ \frac{b^2}{a} + c \ge 0 \end{aligned}\end{equation}\tag{9}\label{eq9}$$

This, along with \eqref{eq8} shows the RHS of \eqref{eq5} holds for $n = n_0$. Next, \eqref{eq6} gives

$$\begin{equation}\begin{aligned} g(n_0) & = \frac{3a(2|b|)}{a} + b \\ & = 6|b| + b \\ & \ge 0 \end{aligned}\end{equation}\tag{10}\label{eq10}$$

You can use a similar procedure for the second case of \eqref{eq3} (i.e., show the RHS of \eqref{eq5} holds for $\frac{|b|}{a} \lt \sqrt{\frac{|c|}{a}}$), and then repeat both steps for the final part of \eqref{eq4}, i.e., to show that $an^2 + bn + c \le c_2n^2$. I'll leave these remaining steps to you to do.

0
On

If $a>0$ and $n\geq1$ then $$an^2+bn+c=n^2\left(a+{b\over n}+{c\over n^2}\right)\left\{\eqalign{&>{a\over4}n^2\cr &<{7a\over4}n^2\cr}\right.\quad,$$ as soon as $n$ is chosen so large that $${|b|\over n}<{a\over2}\qquad\wedge\qquad {|c|\over n^2}<{a\over4}\ .$$ This is fulfilled if $$n>n_0:=2\max\left\{{|b|\over a},\sqrt{{|c|\over a}}\right\}\ .$$