1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Finding Formula for recursive definitions

  1. Mar 8, 2009 #1
    This is the last part of the problem and I just can not figure out a formula for it. Here is what the question asks:

    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.

    I'm stuck on part e:

    f(0) = 2, f(n) = f(n - 1) if n is odd and n >= 1 and f(n) = 2f(n - 2) if n >=2


    I've worked through f(0) - f(9) and I get 2, 2, 4, 4, 8, 8, 16, 16, 32, 32. I just cant seem to figure a formula for this. Any help, much appreciated!
     
  2. jcsd
  3. Mar 8, 2009 #2

    Mark44

    Staff: Mentor

    Are you sure that you have written the definition of the function correctly?
    In particular, it seems that the second part should say that f(n) = 2f(n - 2) if n is even and n >= 2.
     
  4. Mar 8, 2009 #3
    Yes, that is correct. I noticed that too but I typed it exactly the way my book did.
     
  5. Mar 8, 2009 #4

    Dick

    User Avatar
    Science Advisor
    Homework Helper

    Have you defined a floor function? Something like [x]=greatest integer less than or equal to x? That would help you to write it concisely. [n/2] has something in common with your function.
     
  6. Mar 8, 2009 #5

    Mark44

    Staff: Mentor

    It looks to me like this might work as a non-recursive definition for your function:
    f(x) = 2^[itex]\left\lfloor(x + 2)/2 \rfloor\right[/itex]

    The L-shaped brackets indicate the greatest integer function, which is the greatest integer that is less than or equal to what's inside the brackets.

    If the expression in the exponent is an integer, the greatest integer function evaluates to that integer. If the exponent is a non-integer, the greatest integer function essentially chops off the fractional part. For example, the greatest integer in 1 is 1. The greatest integer in 1.5 is 1.

    Using the formula above as a check, f(0) = 2^[itex]\left\lfloor(0 + 2)/2 \rfloor\right[/itex]
    = 2^1 = 2
    f(1) = 2^[itex]\left\lfloor(1 + 2)/2 \rfloor\right[/itex]
    = 2^[itex]\left\lfloor(3)/2 \rfloor\right[/itex] = 2^1 = 2

    f(2) = 2^[itex]\left\lfloor(2 + 2)/2 \rfloor\right[/itex] = 2^2 = 4
    f(3) = 2^[itex]\left\lfloor(3 + 2)/2 \rfloor\right[/itex] = 2^[itex]\left\lfloor 5/2 \rfloor\right[/itex] = 2^2 = 4
     
  7. Mar 8, 2009 #6
    That is it! Thank you all very much.

    Ok, now I need to prove the formula using induction. Kind of stuck there too....?
     
  8. Mar 30, 2009 #7
    Hello,

    I'm in a class that uses the same textbook as caseyd1981. I'm working on this exact same problem. Through looking at relationships between powers of 2 and values of n, I've come up with an explicit formula:
    f(n) = [itex] \left\lceil(n + 1)/2 \rceil\right [/itex]

    Now, I need to prove it using induction (I'm not sure whether it needs to be mathematical induction or strong induction).

    So far, I have this:
    Basis case:
    f(1) = 2^[itex] \left\lceil(1 + 1)/2 \rceil\right [/itex] = 2^[itex] \left\lceil(2)/2 \rceil\right [/itex] = 2^1 = 2.
    Inductive hypothesis:
    if f(n) = 2^[itex] \left\lceil(n + 1)/2 \rceil\right [/itex], then f(n+1) = 2^[itex]\left\lceil((n + 1) + 1) / 2\rceil\right [/itex].

    However, I'm stuck here, as I don't know how to incorporate the inductive hypothesis f(n) = [itex] \left\lceil(n + 1)/2 \rceil\right [/itex] into f(n+1) = 2^[itex]\left\lceil((n + 1) + 1) / 2\rceil\right [/itex].

    Anyone have any suggestions? Thanks for your time!
     
    Last edited: Mar 30, 2009
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Finding Formula for recursive definitions
  1. Recursive definition (Replies: 3)

  2. Recursive formulae (Replies: 14)

  3. Recursive Definition (Replies: 2)

Loading...