Recursive Function for Virus Spread: Finding the General Solution

In summary, the conversation discusses the spread of a virus where on each day, the number of infected people increases by three times the number of infected people on the previous day. Through observation and mathematical analysis, it is concluded that the number of infected people on the nth day is equal to 3^(n-1).
  • #1
Tekilou
1
0
Could anyone please help me I am especially stuck on the second part of the question. Thanks very much I really appreciate it.
20220219_235603.jpg
 
Physics news on Phys.org
  • #2
What did you have for part (i)?
 
  • #3
Did you try writing a few numbers to see if you can see a pattern?

On the first day 1 person has the virus and he gives it to 2 other people.

On the second day 1+ 2= 3 people have the virus.
Each of the 3 give the virus to 2 people, a total of 6 new people.

On the third day, 3+ 6= 9 people have the virus.
Each of the 9 people give the virus to 2 people, a total of 18 new people.

On the fourth day a total of 9+ 18= 27 people have the virus.
Each of the 27 people give the virus to 2 people, a total of 54 new people.

On the fifth day a total of 27+ 54= 81 people have the virus.
Each of the 81 people give the virus to 2 people, a total of 162 new people.

On the sixth day a total of 81+ 162= 243 people have the virus.So far we have 1, 3, 9, 27, 81, 243. I see that those are all powers of 3!
$1= 3^0$, $3= 3^1$, $9= 3^2$, $27= 3^3$, $81= 3^4$, $243=3^5$.

I would conjecture that the number of sick people on the nth day is $3^{n-1}$.

Let $x_n$ be the number of sick people on the nth day. Those $x_n$ people each give the virus to 2 people for a total of $2x_n$ new people so on the n+1 day, $x_{n+1}= x_n+ 2x_n= 3x_n$. Does $x_n= 3^{n-1}$ satisfy that? $x_{n+1}= 3^{n+ 1-1}= 3^n= 3^n+ 2(3^n)= 3(3^n)= 3^{n+1}$. Yes, $x_n= 3^{n-1}$ satisfies this "recurrance relation". Further, $x_1= 3^{1- 1}= 3^0= 1$ as required.
 
  • #4
IF we were a little more "mathematically sophisticated" we could have started from the "recurrence relation". If, on the nth day, $x_n$ people have the virus, each person gives the virus to two new people so a total of $2x_n$ new people. On the n+1 day, $x_{n+ 1}= x_n+ 2x_n= 3x_n$. Since we are repeatedly multiplying by 3, it is easy to see that the general solution to $x_{n+ 1}= 3x_n$ is $x_n= C3^n$ for some constant, C. We have $x_1= 1$ so must have $1= C(3^1)= 3C$ so $C=\frac{1}{3}$. $x_n= \left(\frac{1}{3}\right)3^{n}= 3^{n- 1}$.
 

1. What is a recursive function?

A recursive function is a function that calls itself within its own definition. This allows for the function to repeat and solve a problem in smaller pieces until a base case is reached.

2. How is a recursive function different from a regular function?

A recursive function differs from a regular function in that it calls itself within its own definition. This allows for the function to solve a problem in smaller pieces until a base case is reached, while a regular function typically solves a problem in a linear manner.

3. What is a base case in a recursive function?

A base case in a recursive function is a condition that is used to end the recursive process. It is typically the simplest form of the problem that can be solved without further recursion.

4. What are the advantages of using recursive functions?

Recursive functions can be used to solve complex problems in a more elegant and efficient manner. They also allow for a more concise and readable code compared to using iterative methods.

5. What are some common examples of recursive functions?

Some common examples of recursive functions include calculating factorials, finding the nth term in a Fibonacci sequence, and traversing a binary tree.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
11
Views
846
  • Topology and Analysis
Replies
3
Views
1K
  • Set Theory, Logic, Probability, Statistics
Replies
3
Views
1K
  • Topology and Analysis
Replies
5
Views
1K
Replies
14
Views
2K
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Topology and Analysis
Replies
12
Views
2K
Replies
14
Views
3K
Replies
8
Views
1K
Back
Top