Solve Recurrence Equation w/2 Base Cases Same Result

  • Context: MHB 
  • Thread starter Thread starter ATroelstein
  • Start date Start date
  • Tags Tags
    Base Recurrence
Click For Summary
SUMMARY

The forum discussion addresses the resolution of a recurrence equation with two base cases yielding the same result. The equation is defined as T(n) = 0 for n = 0 and n = 1, and T(n) = T((n-1)/2) + 2 for n > 1. The user successfully derives a closed form T(n) = 2*(log(n+1) - 1) but encounters inconsistencies when attempting to validate both base cases through induction. Ultimately, it is concluded that a single formula cannot satisfy both base cases simultaneously, leading to the proposed solution T(n) = 0 for n = 0 and T(n) = 2*(log2(n+1) - 1) for n ≥ 1.

PREREQUISITES
  • Understanding of recurrence relations
  • Familiarity with logarithmic functions, specifically log base 2
  • Knowledge of mathematical induction
  • Basic algebraic manipulation skills
NEXT STEPS
  • Study advanced techniques in solving recurrence relations
  • Learn about the Master Theorem for analyzing recursive algorithms
  • Explore mathematical induction proofs in depth
  • Investigate the implications of boundary conditions in recurrence equations
USEFUL FOR

Mathematicians, computer scientists, and students studying algorithms who are interested in solving recurrence relations and understanding their implications in algorithm analysis.

ATroelstein
Messages
15
Reaction score
0
This question is related to the question that I have asked here, although the equation is ever so slightly different:
http://www.mathhelpboards.com/f15/solving-specific-variable-when-solving-recurrence-equation-3804/

I have a recurrence equation of the form
$$
T(n) = 0, n = 0, n = 1\\ T(n) = T(\frac{(n-1)}{2}) + 2, n > 1
$$

By unrolling the equation, I get (thanks to I like Serena's help :)):

$$
T(n) = T\left(\frac{n-2^k+1}{2^k}\right) + 2k
$$

Now if I solve for k when
$$
\frac{n-2^k+1}{2^k} = 0
$$

I get
$$
k = log(n+1) - 1
$$

Substituting this back in
$$
T(n) = T(1) + 2*(log(n+1) - 1)\\
T(n) = 2*(log(n+1) - 1)
$$

Now if I wanted to prove my closed form is correct, I have to use induction. I can prove the base case of T(n) = 0 when n = 1. The problem results when I want to also show that the other base case of T(n) = 0 when n = 0. I ran through the full inductive proof and was able to show my closed form is correct, except that lingering base case of 0. How would I go about solving the equation so that I also take into consideration that base case as well? Thanks.
 
Physics news on Phys.org
Hi ATroelstein! :)

When we fill in n=1 in your recurrence relation $T(n) = T(\frac{n-1}{2}) + 2$, we get:
$$T(1) = T(\frac{1-1}{2}) + 2 = T(0)+2=0+2 \ne 0$$
So your boundary conditions for $n=0$ and $n=1$ cannot both be consistent with the recurrence relation for $n \ge 2$.
In other words, there is no solution with just one simple formula.

The solution you would be looking for, is for instance:
$$
T(n) = \left\{\begin{array}{ll}
0 \quad &\text{ if } n=0 \\
2(\log_2(n+1) - 1) \quad &\text{ if } n \ge 1 \\
\end{array}\right.
$$
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 29 ·
Replies
29
Views
5K
Replies
5
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K