Skip to main content
Contents Index
Calc
Dark Mode Prev Up Next Scratch ActiveCode Profile
\(\newcommand\DLGray{\color{Gray}}
\newcommand\DLO{\color{BurntOrange}}
\newcommand\DLRa{\color{WildStrawberry}}
\newcommand\DLGa{\color{Green}}
\newcommand\DLGb{\color{PineGreen}}
\newcommand\DLBa{\color{RoyalBlue}}
\newcommand\DLBb{\color{Cerulean}}
\newcommand\ds{\displaystyle}
\newcommand\ddx{\frac{d}{dx}}
\newcommand\os{\overset}
\newcommand\us{\underset}
\newcommand\ob{\overbrace}
\newcommand\obt{\overbracket}
\newcommand\ub{\underbrace}
\newcommand\ubt{\underbracket}
\newcommand\ul{\underline}
\newcommand\laplacesym{\mathscr{L}}
\newcommand\lap[1]{\laplacesym\left\{#1\right\}}
\newcommand\ilap[1]{\laplacesym^{-1}\left\{#1\right\}}
\newcommand\tikznode[3][]
{\tikz[remember picture,baseline=(#2.base)]
\node[minimum size=0pt,inner sep=0pt,#1](#2){#3};
}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\newcommand{\sfrac}[2]{{#1}/{#2}}
\)
Section Recursive functions
[provisional cross-reference: WORK-IN-PROGRESS]
We often use subscript notation when the function is a recursive function, where we rely on knowing previous values in order to compute the next value, as in the example below. Example: Suppose \(a_{n+1} = 3a_{n} + 2\) and \(a_0 = 3.\)
Find the value of
\(a_1.\) Answer .
\(a\) \(n+1,\) \(a\) \(n\) \(a\) \(n=0,\) \(a_0 = 3.\) \(a\) \(n = 1\)
\begin{align*}
a_1 \amp = 3a_0 + 2\\
\amp = 3\cdot 3 + 2\\
\amp = 11.
\end{align*}
Find the value of
\(a_4.\) Answer .
\(n = 3,\)
\begin{equation*}
a_{4} = 3a_{3} + 2.
\end{equation*}
\(a_3\text{...}\) \(a_3\) \(a_2\text{...}\) \(a_1\)
\begin{align*}
a_2 \amp = 3a_1 + 2\\
\amp = 3\cdot 11 + 2\\
\amp = 35\\
\amp\\
a_3 \amp = 3a_2 + 2\\
\amp = 3\cdot 35 + 2\\
\amp = 107\\
\amp\\
a_4 \amp = 3a_3 + 2\\
\amp = 3\cdot 107 + 2\\
\amp = 323.
\end{align*}
The bottom line with recursive functions is that if we know
\(a_0,\) we can find
\(a_1,\) and then we can find
\(a_2,\) and so on. But if we want to know
\(a_{17},\) for example, we need to know ALL of the previous
\(a\) -values
\(a_0, a_1, a_2, \ldots , a_{16}\text{.}\) Answer .
Given the definition of a recursive function in subscript notation, find the value of the given term.
If
\(a_{n+1} = a_n - 2\) and
\(a_0 = 16,\) evaluate
\(a_3.\) Solution .
\begin{align*}
n = 0: a_1 \amp = a_0 - 2\\
\amp = 16 - 2\\
\amp = 14\\
\amp\\
n = 1: a_2 \amp = a_1 - 2\\
\amp = 14 - 2\\
\amp = 12\\
\amp\\
n = 2: a_3 \amp = a_2 - 2\\
\amp = 12 - 2\\
\amp = 10
\end{align*}
Answer .
\begin{equation*}
a_3 = 10
\end{equation*}
If
\(y_{n+1} = \sin(y_n)\) and
\(y_0 = 0,\) evaluate
\(y_4.\) Solution .
\begin{align*}
n = 0: y_1 \amp = \sin(y_0)\\
\amp = \sin(0)\\
\amp = 0\\
\amp\\
n = 1: y_2 \amp = \sin(y_1)\\
\amp = \sin(0)\\
\amp = 0\\
\amp\\
n = 2: y_3 \amp = \sin(y_2)\\
\amp = \sin(0)\\
\amp = 0\\
\amp\\
n = 3: y_4 \amp = \sin(y_3)\\
\amp = \sin(0)\\
\amp = 0
\end{align*}
Answer .
\begin{equation*}
y_4 = 0
\end{equation*}
If
\(x_{n+1} = x_n^2 - x_n\) and
\(x_0 = 5,\) evaluate
\(x_2.\) Solution .
\begin{align*}
n = 0: x_1 \amp = x_0^2 - x_0\\
\amp = 5^2 - 5\\
\amp = 20\\
\amp\\
n = 1: x_2 \amp = x_1^2 - x_1\\
\amp = 20^2 - 20\\
\amp = 380
\end{align*}
Answer .
\begin{equation*}
x_2 = 380
\end{equation*}
You have attempted
of
activities on this page.