ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Discrete Structures
    CSI-303
    Progress0 / 21 topics
    Topics
    1. Introduction to Logic and Proofs2. Direct Proofs3. Proof by Contradiction4. Sets5. Combinatorics6. Sequences7. Formal Logic8. Propositional and Predicate Calculus9. Methods of Proof10. Mathematical Induction and Recursion11. Loop Invariants12. Relations and Functions13. Pigeonhole Principle14. Trees and Graphs15. Elementary Number Theory16. Optimization and Matching17. Fundamental Structures18. Functions19. Relations (Recursions)20. Cardinality and Countability21. Probabilistic Methods
    CSI-303›Mathematical Induction and Recursion
    Discrete StructuresTopic 10 of 21

    Mathematical Induction and Recursion

    13 minread
    2,139words
    Intermediatelevel

    Mathematical Induction and Recursion

    Both mathematical induction and recursion are foundational concepts in mathematics and computer science, commonly used for proving statements about natural numbers and for defining functions or sequences.


    1. Mathematical Induction

    Mathematical induction is a powerful proof technique used to prove statements or propositions that are asserted for all natural numbers or integers. It is particularly useful when proving formulas, inequalities, or properties that hold for an infinite set of numbers.

    The Principle of Mathematical Induction:

    Mathematical induction consists of two primary steps:

    1. Base Case: Prove that the statement holds for the smallest value of nnn, typically n=1n = 1n=1 or n=0n = 0n=0.
    2. Inductive Step: Assume that the statement holds for some arbitrary integer n=kn = kn=k (called the inductive hypothesis), and then prove that the statement holds for n=k+1n = k + 1n=k+1.

    If both steps are successfully proven, the statement is valid for all integers nnn starting from the base case.

    Steps of Induction:

    1. Base Case: Show that the statement is true for the initial value (usually n=1n = 1n=1 or n=0n = 0n=0).
    2. Inductive Hypothesis: Assume the statement is true for some arbitrary integer n=kn = kn=k.
    3. Inductive Step: Use the assumption (inductive hypothesis) to prove that the statement holds for n=k+1n = k + 1n=k+1.
    4. Conclusion: Since both steps are true, the statement is true for all integers greater than or equal to the base case.

    Example of Mathematical Induction:

    Statement: Prove that for all n∈Nn \in \mathbb{N}n∈N,

    1+2+3+⋯+n=n(n+1)21 + 2 + 3 + \cdots + n = \frac{n(n+1)}{2}1+2+3+⋯+n=2n(n+1)​
    • Base Case: For n=1n = 1n=1, the left-hand side is 111, and the right-hand side is 1(1+1)2=1\frac{1(1+1)}{2} = 121(1+1)​=1. Therefore, the base case holds true.

    • Inductive Hypothesis: Assume that the formula is true for some k∈Nk \in \mathbb{N}k∈N, i.e.,

      1+2+3+⋯+k=k(k+1)21 + 2 + 3 + \cdots + k = \frac{k(k+1)}{2}1+2+3+⋯+k=2k(k+1)​
    • Inductive Step: We need to prove that the formula holds for k+1k + 1k+1. Starting with the left-hand side:

      1+2+3+⋯+k+(k+1)1 + 2 + 3 + \cdots + k + (k+1)1+2+3+⋯+k+(k+1)

      By the inductive hypothesis, we can substitute 1+2+3+⋯+k1 + 2 + 3 + \cdots + k1+2+3+⋯+k with k(k+1)2\frac{k(k+1)}{2}2k(k+1)​:

      k(k+1)2+(k+1)\frac{k(k+1)}{2} + (k+1)2k(k+1)​+(k+1)

      Factor out (k+1)(k+1)(k+1):

      (k+1)(k2+1)=(k+1)(k+22)(k+1) \left( \frac{k}{2} + 1 \right) = (k+1) \left( \frac{k+2}{2} \right)(k+1)(2k​+1)=(k+1)(2k+2​)

      Simplifying:

      =(k+1)(k+2)2= \frac{(k+1)(k+2)}{2}=2(k+1)(k+2)​

      This matches the right-hand side of the formula for n=k+1n = k + 1n=k+1. Therefore, the inductive step holds.

    • Conclusion: By the principle of mathematical induction, the formula is true for all n∈Nn \in \mathbb{N}n∈N.


    2. Recursion

    Recursion is a technique where a function or sequence is defined in terms of itself. Recursive definitions are used to break down complex problems into simpler subproblems that follow a repetitive structure.

    Key Elements of Recursion:

    1. Base Case: A simple case that can be solved directly without further recursion. The base case prevents the recursion from continuing indefinitely.
    2. Recursive Case: Defines the function or sequence for larger inputs in terms of smaller inputs.

    Types of Recursive Definitions:

    1. Recursive Function: A function that calls itself within its own definition.

      Example: Factorial function n!n!n! is defined as:

      n!={1if n=0n×(n−1)!if n>0n! = \begin{cases} 1 & \text{if } n = 0 \\ n \times (n-1)! & \text{if } n > 0 \end{cases}n!={1n×(n−1)!​if n=0if n>0​

      This is a recursive definition where the factorial of a number is defined in terms of the factorial of a smaller number.

      Example Calculation:

      5!=5×4!=5×(4×3!)=5×(4×(3×2!))=5×(4×(3×(2×1!)))=5×(4×(3×(2×1)))5! = 5 \times 4! = 5 \times (4 \times 3!) = 5 \times (4 \times (3 \times 2!)) = 5 \times (4 \times (3 \times (2 \times 1!))) = 5 \times (4 \times (3 \times (2 \times 1)))5!=5×4!=5×(4×3!)=5×(4×(3×2!))=5×(4×(3×(2×1!)))=5×(4×(3×(2×1)))

      5!=1205! = 1205!=120.

    2. Recursive Sequence: A sequence where each term is defined in terms of previous terms.

      Example: The Fibonacci sequence is defined recursively as:

      F(n)={0if n=01if n=1F(n−1)+F(n−2)if n>1F(n) = \begin{cases} 0 & \text{if } n = 0 \\ 1 & \text{if } n = 1 \\ F(n-1) + F(n-2) & \text{if } n > 1 \end{cases}F(n)=⎩⎨⎧​01F(n−1)+F(n−2)​if n=0if n=1if n>1​

      The Fibonacci numbers are defined by the sum of the two preceding numbers, starting with 0 and 1.

      Example Calculation:

      F(5)=F(4)+F(3)=(F(3)+F(2))+(F(2)+F(1))=…=5F(5) = F(4) + F(3) = (F(3) + F(2)) + (F(2) + F(1)) = \ldots = 5F(5)=F(4)+F(3)=(F(3)+F(2))+(F(2)+F(1))=…=5

      The first few Fibonacci numbers are: F(0)=0F(0) = 0F(0)=0, F(1)=1F(1) = 1F(1)=1, F(2)=1F(2) = 1F(2)=1, F(3)=2F(3) = 2F(3)=2, F(4)=3F(4) = 3F(4)=3, F(5)=5F(5) = 5F(5)=5.

    Solving Recursions:

    When dealing with recursions, you typically need to:

    1. Identify the base case: This allows you to stop the recursion.
    2. Simplify the recursive case: Break down the problem by reducing it to simpler subproblems.
    3. Solve the recursive case step by step: Use the recursive calls to solve the problem by reducing it to smaller instances until you reach the base case.

    Example of Recursion in Computer Science:

    Recursive algorithms are often used in computer science for tasks like sorting, searching, and traversal. For example, the Merge Sort algorithm divides an array into smaller arrays recursively, sorts them, and then merges them back together.


    3. Mathematical Induction and Recursion: Connection

    While mathematical induction is used to prove properties of sequences, formulas, or statements, recursion is often used to define sequences or functions. In many cases, the recursive structure of a problem is used to build up the solution, while induction is used to prove that the recursive definition holds for all cases.

    For example, the Fibonacci sequence can be defined recursively, and mathematical induction can be used to prove properties about the sequence, such as the sum of the first nnn Fibonacci numbers.

    Induction and Recursion Example:

    Suppose we want to prove by induction that the nnn-th Fibonacci number is less than or equal to 2n2^n2n for all n≥0n \geq 0n≥0.

    Base Case: For n=0n = 0n=0, F(0)=0≤20=1F(0) = 0 \leq 2^0 = 1F(0)=0≤20=1. Thus, the base case holds.

    Inductive Hypothesis: Assume that the statement holds for n=kn = kn=k, i.e., F(k)≤2kF(k) \leq 2^kF(k)≤2k, and F(k−1)≤2k−1F(k-1) \leq 2^{k-1}F(k−1)≤2k−1.

    Inductive Step: We need to prove that F(k+1)≤2k+1F(k+1) \leq 2^{k+1}F(k+1)≤2k+1. By the recursive definition of Fibonacci numbers:

    F(k+1)=F(k)+F(k−1)F(k+1) = F(k) + F(k-1)F(k+1)=F(k)+F(k−1)

    Using the inductive hypothesis:

    F(k+1)≤2k+2k−1=2k−1(2+1)=2k−1×3=2k+1F(k+1) \leq 2^k + 2^{k-1} = 2^{k-1}(2 + 1) = 2^{k-1} \times 3 = 2^{k+1}F(k+1)≤2k+2k−1=2k−1(2+1)=2k−1×3=2k+1

    Thus, the statement holds for k+1k + 1k+1, and by induction, it holds for all n≥0n \geq 0n≥0.


    Conclusion

    Mathematical induction and recursion are two fundamental concepts in mathematics and computer science. Mathematical induction is a technique for proving that a statement is true for all natural numbers, while recursion is a method of defining functions or sequences in terms of themselves. Induction can often be used to prove the correctness of recursive definitions or algorithms. Both techniques are essential for

    Previous topic 9
    Methods of Proof
    Next topic 11
    Loop Invariants

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time13 min
      Word count2,139
      Code examples0
      DifficultyIntermediate