Question

In: Computer Science

Define the following function f(n) = 5(2^n)-(2^(n-1)), n ≥ 1. Write a recursive definition for the...

Define the following function f(n) = 5(2^n)-(2^(n-1)), n ≥ 1. Write a recursive definition for the function f(n)?
Consider the following recurrence: an= 2an-1 + 3 (where a1 = 1). Compute the values of an for n ≤ 5. Find a solution for the recurrence definition and validate its correctness.
Consider the following recurrence: an=2an-1 +an-1an-2 (where a1 = 1). Compute the values of an for n ≤ 5.

Solutions

Expert Solution

Solution 1

Note that 2n = 2n-1 + 2n-1

f(n) = 5(2^n)-(2^(n-1))

= 5(2^(n-1))

f(n) = 5(2^(n-1))

f(n-1) = 5(2^(n-2))

f(n) = 5(2^(n-1))  = 5(2^(n-2)) * 5(2^(n-2)) =f(n-1) * f(n-1)

Result:

f(n) = f(n-1) * f(n-1)

To verify our result note that:

f(1) = 52 - 1 = 51

f(2) = 54 - 2 = 52 = f(1) * f(1)

f(3) = 58 - 4 = 54 = f(2) * f(2)

f(4) = 516 - 8 = 58 = f(3) * f(3)

f(5) = 532 - 16 = 516 = f(4) * f(4)

Solution 2

an= 2an-1 + 3 (where a1 = 1)

a2= 2a1 + 3 = 2 * 1 + 3 = 5

a3= 2a2 + 3 = 2 * 5 + 3 = 13

a4= 2a3 + 3 = 2 * 13 + 3 = 29

a5= 2a4 + 3 = 2 * 29 + 3 = 61

Note that an= 2n+1 - 3

So  a1 = 22 - 3 = 4 -3 = 1

  a2 = 23 - 3 = 8 -3 = 5

a3= 24 - 3 = 16 -3 = 13

a4 = 25 - 3 = 32 -3 = 29

a5 = 26 - 3 = 64 -3 = 61

Result

an= 2n+1 - 3

Solution 3

an=2an-1 +an-1an-2 (where a1 = 1)

a2 = 2a1 +a1a0 = 2*1 + 1*0 = 2

a3=2a2 +a2a1 = 2*2 + 2*1 = 4+2 = 6

a4=2a3 +a3a2 = 2*6 + 6*2 = 12+12 = 24

a5=2a4 +a4a3 = 2*24 + 24*6 = 48+144 = 192


Related Solutions

Part 1: Write a recursive function that will calculate Fibonacci numbers using a recursive definition. Write...
Part 1: Write a recursive function that will calculate Fibonacci numbers using a recursive definition. Write a short program to test it. The input of this program must be a positive integer n; the output is the corresponding Fibonacci number F(n) Part 2: Write an iterative function to calculate Fibonacci numbers. Write a test driver for it. The input of this program must be a positive integer n; the output is the corresponding Fibonacci number F(n). Part 3: Write a...
Determine if each of the following recursive definition is a valid recursive definition of a function...
Determine if each of the following recursive definition is a valid recursive definition of a function f from a set of non-negative integers. If f is well defined, find a formula for f(n) where n is non-negative and prove that your formula is valid. f(0) = 1, f(n) = -f(n-1) + 1 for n ≥ 1 f(0) = 0, f(1) = 1, f(n) = 2f(n-1) +1 for n ≥ 1 f(0) =0, f(n) = 2f(n-1) + 2 for n ≥...
Give a recursive algorithm to solve the following recursive function. f(0) = 0;    f(1) = 1;...
Give a recursive algorithm to solve the following recursive function. f(0) = 0;    f(1) = 1;   f(2) = 4; f(n) = 2 f(n-1) - f(n-2) + 2; n > 2 b) Solve f(n) as a function of n using the methodology used in class for Homogenous Equations. Must solve for the constants as well as the initial conditions are given.
Determine whether each of these proposed definitions is a valid recursive definition of a function f...
Determine whether each of these proposed definitions is a valid recursive definition of a function f from the set of nonnegative integers to the set of integers. If f is well defined, find a formula for f (n) when n is a nonnegative integer and prove that your formula is valid. e) f (0) = 2, f (n) = f (n − 1) if n is odd and n ≥ 1 and f (n) = 2f (n − 2) if...
Determine whether each of these proposed definitions is a valid recursive definition of a function f...
Determine whether each of these proposed definitions is a valid recursive definition of a function f from the set of nonnegative integers to the set of integers. If f is well defined, find a formula for f(n) when n is a nonnegative integer and prove that your formula is valid. a) f(0) = 1, f(n) = -f(n-1) for n ≥ 1 b) f(0) = 1, f(1) = 0, f(2) = 2, (n) = f(n-3) for n ≥ 3. c) f(0)...
Write a recursive function to implement the Factorial of n (n!). In the main, let the...
Write a recursive function to implement the Factorial of n (n!). In the main, let the user input a positive integer and call your function to return the result.
C++ Write a recursive function that computes and returns the product of the first n >=1...
C++ Write a recursive function that computes and returns the product of the first n >=1 real numbers in an array.
a) write a program to compute and print n, n(f), f(f(n)), f(f(f(n))).........for 1<=n<=100, where f(n)=n/2 if...
a) write a program to compute and print n, n(f), f(f(n)), f(f(f(n))).........for 1<=n<=100, where f(n)=n/2 if n is even and f(n)=3n+1 if n is odd b) make a conjecture based on part a. use java
For the following exercises, write a recursive formula for each arithmetic sequence. a = {−1, 2, 5, ... }
For the following exercises, write a recursive formula for each arithmetic sequence.a = {−1, 2, 5, ... }
Write a recursive function to calculate and return factorial of a given number 'n'. in C...
Write a recursive function to calculate and return factorial of a given number 'n'. in C progrmaining
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT