Skip to main content
Engineering LibreTexts

2.8: Recursive Definitions

  • Page ID
    9826
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Recursion occurs in programming when a subroutine is defined—or at least partially defined—in terms of itself. But recursion also occurs outside of programming. A recurs- ive definition is a definition that includes a reference to the term that is being defined. A recursive definition defines something at least partially in terms of itself. As in the case of recursive subroutines, mathematical induction can often be used to prove facts about things that are defined recursively.

    As I already noted, there is a recursive definition for n!, for n in N, and we can use this definition to prove facts about the factorials. We can define 0! = 1 and n! = n · (n − 1)!for n > 0. Do you see how the base case and the inductive case in an inductive proof can correspond to the two parts of the recursive definition?
    Other sequences of numbers can also be defined recursively. For example, the famous Fibonacci sequence is the sequence of numbers \(f_{0}, f_{1}, f_{2}, \ldots,\) defined recursively by

    \(f_{0}=0\)

    \(f_{1}=1\)

    \(f_{n}=f_{n-1}+f_{n-2} \qquad\) for \(n>1\)

    Using this definition, we compute that

    \(f_{2}=f_{1}+f_{0}=0+1=1\)
    \(f_{3}=f_{2}+f_{1}=1+1=2\)
    \(f_{4}=f_{3}+f_{2}=2+1=3\)
    \(f_{5}=f_{4}+f_{3}=3+2=5\)
    \(f_{6}=f_{5}+f_{4}=5+3=8\)
    \(f_{7}=f_{6}+f_{5}=8+5=13\)

    and so on. Based on this definition, we can use induction to prove facts about the Fibonacci sequence. We can prove, for example, that \(f_{n}\) grows exponentially with \(n,\) even without finding an exact formula for \(f_{n} :\)

    Theorem 3.14.

    The Fibonaccisequence, \(f_{0}, f_{1}, f_{2}, \ldots,\) satisfies \(f_{n}>\left(\frac{3}{2}\right)^{n-1},\) for \(n \geq 6\)

    Proof. We prove this by induction on \(n .\) For \(n=6,\) we have that \(f_{n}=8\) while \(1.5^{n-1}=\) \(1.5^{5},\) which is about \(7.6 .\) So \(f_{n}>1.5^{n-1}\) for \(n=6 .\) Similarly, for \(n=7,\) we have \(f_{n}=13\)and \(1.5^{n-1}=1.5^{6},\) which is about \(11.4 .\) So \(f_{n}>1.5^{n-1}\) for \(n=7\)

    Now suppose that k is an arbitrary integer with k > 7. Suppose that we already know that \(f_{n}>1.5^{n-1}\) for \(n=k-1\) and for \(n=k-2 .\) We want to show that the inequality then holds for n = k as well. But

    \(f_{k}=f_{k-1}+f_{k-2}\)

    \(>1.5^{(k-1)-1}+1.5^{(k-2)-1}\) (by the induction hypothesis)

    \(=1.5^{k-2}+1.5^{k-3}\)

    \(=(1.5) \cdot\left(1.5^{k-3}\right)+\left(1.5^{k-3}\right)\)

    \(=(2.5) \cdot\left(1.5^{k-3}\right)\)

    \(>\left(1.5^{2}\right) \cdot\left(1.5^{k-3}\right)\) \(\left(\text { since } 1.5^{2}=2.25\right)\)

    \(=1.5^{k-1}\)

    This string of equalities and inequalities shows that \(f_{k}>1.5^{k-1} .\) This completes the induction and proves the theorem.

    Exercises

    1. Prove that the Fibonacci sequence, \(f_{0}, f_{1}, f_{2}, \dots,\) satisfies \(f_{n}<2^{n}\) for all natural numbers \(n \geq 1\)

    2. Suppose that \(a_{1}, a_{2}, a_{3}, \ldots,\) is a sequence of numbers which is defined recursively by \(a_{1}=1\) and \(a_{n}=2 a_{n-1}+2^{n-1}\) for \(n>1 .\) Prove that \(a_{n}=n 2^{n-1}\) for every positive integer \(n\)


    This page titled 2.8: Recursive Definitions is shared under a not declared license and was authored, remixed, and/or curated by Stefan Hugtenburg & Neil Yorke-Smith (TU Delft Open) via source content that was edited to the style and standards of the LibreTexts platform.