Prove or disprove big-O asymptotic notation

148 Views Asked by At

1.Let $f_1(n),f_2(n)...f_n(n)...$be an infinite series of functions. $f_i(n)$ belongs to $O(n)$ for all $i$. Let $g(k)= \sum_{j=1}^kf_j(j)$ (i.e. $g(1)=f_1(1),g(2)=f_1(1)+f_2(2)$) then $g(n)$ belongs to $O(n^2)$

2.Let $f_i(n)$ belongs to $O(n)$ for all $i$. Let $g(k)= \sum_{j=1}^kf_j(j)$ (i.e. $g(1)=f_1(1),g(2)=f_1(1)+f_2(2)$) then $g(n)$ belongs to $O(n^2)$

Will the infinite series influence the result? I know that fi(n)<=c1n, f1(1)<=c1n f1(1)+f2(2)<=(c1+c2)*n ...... f1(1)+....+fk(k)<=(c1+....+ck)*n means g(k)<=O(n)<=O(n^2) But i don't know how to will the infinite series of functions influence the result,or both of these have the same result like above.

If my thought is wrong,please help me know how to prove or disprove these two questions,thanks.

1

There are 1 best solutions below

0
On

This is not valid reasoning because you don't have any control over the constant which is implicit in the big $O$ in $f_i(n)=O(n)$. For example, you could set $$f_i(n):=2^in,\qquad\hbox{$i=1$, 2, 3, $\dots$.}$$ Then each $f_i(n)$ is $O(n)$ but $$g(n)=\sum_{1\le j\le n} f_j(j) = \sum_{1\le j\le n} 2^j j=2^{n+1}(n-1)+2,$$ which is not $O(n^2)$. Another problem is the constant which is implicit in the "for large $n$" implied in the big $O$. For an example to illustrate this problem, set $$f_i(n):=\left\{\begin{array}{ll}2^i,&\hbox{$n\le i$,}\\n,&\hbox{$n>i$,}\end{array}\right.\qquad\hbox{$i=1$, 2, 3, $\dots$}$$ Then each $f_i(n)$ is $O(n)$ but $$g(n)=\sum_{1\le j\le n} f_j(j)=\sum_{1\le j\le n} 2^j=2^{n+1}-2$$ which is also not $O(n^2)$.

Conclusion: To draw conclusions like this, you need to have stronger bounds on $f_i(n)$ which have some uniformity in $i$. Taking $f_i(n)=O(n)$ individually is not good enough.