Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have found the complexity of an algorithm as the expression below. How can I find the complexity in big O notation for such expression? Or prove that it's bounded by $n^3$ or $n^4$. Can I use triple integral to approximate? If so, do I have to consider any error (I just want the highest degree of the resulting polynomial)?

I run 10000 numbers and apparently it is bounded by $n^3$ (can't say for sure).

$\sum_{j=3}^{n} \left[(j-1)[2(j-2)-1] + \sum_{i=2}^{j-2}(i) + \sum_{k=2}^{j-2}\left[k(j-(k+1))+\sum_{i=k}^{j-2}(i)\right]\right]$


share|cite|improve this question
up vote 0 down vote accepted

Using various forms of the key relation $\sum\limits_{s=1}^ts^a=O(t^{a+1})$ when $t\to\infty$, for each $a\geqslant0$, one sees that the $n$th sum $S_n$ is $$ S_n=\sum_{j\leqslant n}j^2+O(j^2)+O(j^3)+jO(j^2)=\sum_{j\leqslant n}O(j^3)=O(n^4). $$

share|cite|improve this answer
Thank for the answer! But one question: inside the parenthesis, there is a -$k^2$ (neg.) and a $jk$ (pos.), doesn't it matter? Is it still $O(j^3)$+$jO(j^2)$ (one negative and another positive)? And also $k$ is always bounded by $j$ (lower or equal than j-2). Thanks again! – pandrade Jan 25 '13 at 12:52
Yes, $k(j-(k+1))\leqslant j^2$ and you sum $j-4$ of these hence the result is $\leqslant j^3$. – Did Jan 25 '13 at 13:25
That you! I appreciate it. – pandrade Jan 25 '13 at 14:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.