# Solving Recurrence Relations with induction

We got the following tasks in our Higher Algorithm class, to repeat our proof techniques from class:

1. Find asymptotic upper bounds (as sharp as possible) for $$T(n)$$ in each of the following cases,
using your favorite method.
You may assume that $$T(n) < 10$$ for all $$0 ≤ n ≤ 5$$.

Where me and my colleague got stuck specifically are the following functions:

D) $$T(n) = T(n − 1) + 1/n$$
E) $$T(n) = T(3n/4) + T(n/4) + n$$

In the lecture we learned three methods to proof the recurrences:

1. Direct method (just expand until you see f.e. a sum for which you know the growth rate
2. Master theorem
3. Induction

Specifically for Induction we got told to start expanding our T(n) so we can see patterns and make a good guess for the induction claim.

In D) we noticed that the function generated the harmonic partial sum.
And for E) we noticed that the recurrence generated the values of the pascal triangle, so basically the binomial coefficients.

Our issue is that we are not really sure, how to use those insights to make a good guess for the induction.

I checked the following answer Median of Medians Time Complexity but was unable to replicate the procedure, as no matter what I plugged in, I would not get my induction guess as a result to finish the proof..

As we need to write an exam at the end of the semster, help in understanding rather than straight up solutions are much appreciated! :-)

Since you already noticed that the solution to D) appears to be $$T(n) = H_n$$, where $$H_n = \sum_{i=1}^n \frac{1}{i}$$ is the $$n$$-th harmonic number, why don't you use exactly this guess for the induction proof?

Assuming $$T(1)=1$$, you have:

• Base case: For $$n=1$$, $$T(1)=1=H_1$$.
• Inductive step, assume that $$n>1$$ and that $$T(n-1)=H_{n-1}$$. You have $$T(n)= T(n-1) + \frac{1}{n} = H_{n-1} + \frac{1}{n} = \sum_{i=1}^{n-1} \frac{1}{i} + \frac{1}{n} = \sum_{i=1}^{n} \frac{1}{i} = H_n$$.

For E) you can observe that each level of the recursion tree contributes $$O(n)$$ to the final value of the recurrence. Since there are $$O(\log n)$$ levels, we must have $$T(n) = O(n \log n)$$. Similarly, each of the first $$\lfloor \log_4 n \rfloor = \Omega(\log n)$$ levels of the tree contributes $$\Omega(n)$$, and hence we also have $$T(n) = \Omega(n \log n)$$. Combining the upper and lower bound we get $$T(n) = \Theta(n \log n)$$.

If you insist on using induction you can use the above observation to guess that a solution will satisfy $$T(n)=a n \log n + b$$ for some constants $$a > 0$$, and $$b$$.

• Base case: for $$2 \le n < 8$$, $$T(n) \le b \le a n \log n + b$$ whenever $$b$$ is sufficiently large (regardless of the choice of $$a$$).
• Inductive step, consider $$n \ge 8$$ and assume that $$T(n') \le a n' \log n' + b$$ for all $$2 \le n' \le \frac{3}{4}n$$. \begin{align*}T(n) &= T(3n/4) + T(n/4) + n \le \frac{3}{4} an \log(3n/4) + b + \frac{1}{4} an \log(n/4) + b \\ &\le a n \log (3n/4) + 2b = an \log(n) - a n \log(4/3) + 2b \\ &\le a n \log (n) - 8a + 2b. \end{align*} This is at most $$a n \log n + b$$ as soon as $$a \ge b/8$$.