A functional fix

Algebra Level 5

Suppose f f is a function from the positive integers to the positive integers that satisfies

f ( n ) = { n 600 , for n > 2013 , f ( f ( n + 800 ) ) , for n 2013. f(n) = \begin{cases} n - 600, & \text{ for } n > 2013,\\ f( f(n + 800)), & \text{ for } n \leq 2013. \\ \end{cases}

How many fixed points does f f have?

Details and assumptions

A fixed point of a function f f is a value x x which satisfies f ( x ) = x f(x) = x .


The answer is 200.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

8 solutions

Calvin Lin Staff
Oct 18, 2013

While the following solutions are correct, they were all extremely long and failed to express the essence of the problem. The key to this problem is understand how the function works, in order to interpret it.


When n 2013 n \leq 2013 and n + 800 > 2013 n + 800 > 2013 , then we get that f ( n ) = f ( f ( n + 800 ) ) = f ( n + 200 ) f(n) = f( f(n+800)) = f(n+200) . As such, for i = 1 i = 1 to 200, we have

f ( 1213 + i ) = f ( 1413 + i ) = f ( 1613 + i ) = f ( 1813 + i ) = f ( 2013 + i ) = 1413 + i . f( 1213 + i) = f(1413 + i) = f(1613 + i) \\ = f(1813 + i) = f(2013 + i ) = 1413 + i.

This gives us 200 fixed points, of the form n = 1413 + i n = 1413 + i .

For n > 2013 n > 2013 , since f ( n ) = n 600 f(n) = n-600 , there are no fixed points. For n < 1213 n < 1213 , we see that f ( n ) 1414 f(n) \geq 1414 , hence there are no fixed points either.

Thus, in total, there are 200 fixed points.

Julio Reyes
Oct 14, 2013

It's important to understand how the recursion in the function works and what the condition is for exiting. The function will only end when 2 values are generated in succession that are greater than 2013.

The general process of the function is something like:

f ( n ) 1 n 1 > 2013 ? False n 1 = n 1 + 800 f ( n 1 ) n 1 > 2013 ? False n 2 = n 1 + 800 f ( n 2 ) n 2 > 2013 ? False n 3 = n 2 + 800 f ( n i 1 ) n i 1 > 2013 ? False n i + 1 = n i + 1 + 800 f ( n i + 1 ) n i + 1 > 2013 ? True n i + 2 = n i + 1 600 f ( n i + 2 ) n i + 2 > 2013 ? False n i + 3 = n i + 2 + 800 f ( n i + 3 ) n i + 3 > 2013 ? True n i + 4 = n i + 3 600 f ( n k 3 ) n k 3 > 2013 ? False n k 2 = n k 3 + 800 f ( n k 2 ) n k 2 > 2013 ? True n k 1 = n k 2 600 f ( n k 1 ) n k 1 > 2013 ? True n k 1 = n k 1 600 f ( n ) = n k \begin{array}{ll} f(n)\phantom{_1} \rightarrow & n\phantom{_1} > 2013 \text{ ?}& \text{False} \rightarrow & n_1 = n \phantom{_1} + 800 \Rightarrow \\ f(n_1) \rightarrow & n_1 > 2013 \text{ ?}& \text{False} \rightarrow & n_2 = n_1 + 800 \Rightarrow \\ f(n_2) \rightarrow & n_2 > 2013 \text{ ?}& \text{False} \rightarrow & n_3 = n_2 + 800 \Rightarrow \\ \vdots \\ f(n_{i\phantom{-1}}) \rightarrow & n_{i\phantom{-1}} > 2013 \text{ ?} & \text{False} \rightarrow & n_{i+1} = n_{i\phantom{+1}} +800 \Rightarrow \\ f(n_{i+1}) \rightarrow & n_{i+1} > 2013 \text{ ?} & \text{True } \rightarrow & n_{i+2} = n_{i+1} -600 \Rightarrow \\ f(n_{i+2}) \rightarrow & n_{i+2} > 2013 \text{ ?} & \text{False} \rightarrow & n_{i+3} = n_{i+2} +800 \Rightarrow \\ f(n_{i+3}) \rightarrow & n_{i+3} > 2013 \text{ ?} & \text{True } \rightarrow & n_{i+4} = n_{i+3} -600 \Rightarrow \\ \vdots \\ f(n_{k-3}) \rightarrow & n_{k-3} > 2013 \text{ ?} & \text{False} \rightarrow & n_{k-2} = n_{k-3} +800 \Rightarrow \\ f(n_{k-2}) \rightarrow & n_{k-2} > 2013 \text{ ?} & \text{True } \rightarrow & n_{k-1} = n_{k-2} -600 \Rightarrow \\ f(n_{k-1}) \rightarrow & n_{k-1} > 2013 \text{ ?} & \text{True } \rightarrow & n_{k\phantom{-1}} = n_{k-1} -600 \Rightarrow \\ f(n) = n_k \end{array}

Notice, that the set of values for n that could possibly satisfy f(n) = n have to be n > 1413 . That is because the last step ( n - 600 ) is only done if n > 2013 . The smallest value that n can be at that point is 2014 , and 2014 - 600 = 1414 . So no value of n < 1414 could satisfy the problem.

After making some observations, we can come up with an a set of operations that n will go through.

n + 800 600 + 800 600 + + 800 600 600 = n k Note: +800 does not repeat because only values n < 1214 repeat the inital step. n + 800 - 600 + 800 - 600 + \cdots + 800 - 600 - 600 = n_k \\ _{\text{Note: +800 does not repeat because only values n < 1214 repeat the inital step. }}

Notice, that the operations alternate between + 800 and - 600 , up till the last operation. We can simplify this to :

n + 800 x 600 x 600 = n k n + 200 x 600 = n k where x is how many times the pattern is repeated n +800x - 600x - 600 = n_k \quad \Rightarrow \quad n + 200x - 600 = n_k \\ _{\text{where x is how many times the pattern is repeated}}

Solving for x will let us know how many times that pattern repeats for the set of values that satisfy f(n) = n .

n + 800 x 600 x 600 = n k 200 x = 600 x = 3 Note: we can cancel n and n k since we are assuming that n = n k n + 800x - 600x - 600 = n_k \Rightarrow \quad 200x = 600 \Rightarrow \quad x = 3 \\ _{\text{Note: we can cancel } n\text{ and } n_k \text{ since we are assuming that } n = n_k }

If we look at the step before the last, we can make the following statements.

n + 200 x = n k 1 a n d n k 1 > 2013 n + 200 3 = n k 1 n + 600 = n k 1 n + 600 > 2013 n > 1413 n + 200x = n_{k-1} \quad and \quad n_{k-1} > 2013 \\ n + 200 \cdot 3 = n_{k-1} \quad \Rightarrow \quad n + 600 = n_{k-1} \\ \therefore \quad n + 600 > 2013 \quad \Rightarrow \quad n > 1413

We now have our lower limit for the set of values that satisfy f(n) = n . We know that all these values must repeat the middle pattern 3 times. If they do not, they will not satisfy the condition.

To find the upper limit we will find the numbers that repeat the pattern 2 times. We do this because the numbers that repeat the pattern only 2 times are larger, and the point at which this transition happens will be our upper limit.

n + 200 x = n k 1 a n d n k 1 > 2013 n + 200 2 = n k 1 n + 400 = n k 1 n + 400 > 2013 n > 1613 n + 200x = n_{k-1} \quad and \quad n_{k-1} > 2013 \\ n + 200 \cdot 2 = n_{k-1} \quad \Rightarrow \quad n + 400 = n_{k-1} \\ \therefore \quad n + 400 > 2013\quad \Rightarrow \quad n > 1613

So the range of values for n that satisfy f(n) = n is:

( 1413 , 1613 ) 1613 1413 = 200 (1413, 1613) \\ 1613 - 1413 = \fbox{200}

My solution was getting too long so shorten it to include my process, but that doesnt give all the details to how I came to my conclusion. Below is my reasoning behind some of the things I did.

Method for finding the pattern of operations:

The function can be broken into 3 stages. Depending on what the initial value for n is, some of the stages may be skipped. We can find the point when this happens by observing the behavior of the function.

When n > 1213 , the 1st stage is skipped. This is because the 1st condition of the function will only be met after the inital check if n + 800 > 2013 . We can do a test to verify this by plugging in 2013 and 2014 and observing the behavior.

When n > 1813 , the 1st and 2nd stage are skipped. We can deduce this in a similar manner that we did for the first stage, that is when n + 800 - 600 > 2013 .

Notice, that the set of values for n that could possibly satisfy f(n) = n have to be n > 1413 . That is because the last step ( n - 600 ) is only done if n > 2013 . The smallest value that n can be at that point is 2014 , and 2014 - 600 = 1414 . So no value of n < 1414 could satisfy the problem.

Doing a similar test, we can see that the set of values of n that could satisfy f(n) = n have to be n < 1814. That is because values > 1813 skip the 1st and 2nd stage. So the operations that will be performed on those values are: + 800 , - 600 , and - 600 . These operations could never return the initial value.

Now we have been able to reduce the range of the possible values to 1413 < n < 1814 . But more importantly, we have deduced the stages that the set of values will go through, which prove key in solving the problem.

We now know the set of values of n that could satisfy f(n) = n skip the first stage, since the range is greater than 1213, but do go through the 2nd and 3rd stage since the range is less than 1814. From this we come up with the pattern for the operations that will be perform on n :

n + 800 600 + 800 600 + + 800 600 600 = n k n + 800 - 600 + 800 - 600 + \cdots + 800 - 600 - 600 = n_k

Julio Reyes - 7 years, 8 months ago

Log in to reply

really good one.

Kiran K - 7 years, 7 months ago
Samuel Hatin
Oct 14, 2013

First, we can rewrite the given equation, we have :

f(n) = \left\{ \begin{array}{l} n - 600\\ f(f(n + 800) \end{array} \right.\begin{array}{*{20}{c}} {n > 2013}\\ {n \le 2013} \end{array} = \left\{ \begin{array}{l} n - 600\\ f(n + 200) \end{array} \right.\begin{array}{*{20}{c}} {n > 2013}\\ {n \le 2013} \end{array}

The way we can interpret this is that for every number smaller or equal to 2013, we have to add 200 to it then plug it in the function again to see if it's greater to 2013 or smaller or equal. Depending on the result we subtract 600 (if it's greater then 2013) or add 200 and try again. We observe that for any integer between 14 and 213, the function gives 1414 up to 1613. I am not used to this kind of algebra so I do not know the exact term, but I would call this function periodical, the period would be from 14 to 213, the other would be 214 to 413, etc. In general, it starts from

14 + 200 n 14 + 200n

and it ends at

213 + 200 n 213 + 200n

Now we must find the numbers where f(n)=n. Let's see if f(1414)=1414. We must add 3 times 200 to get over the 2013 limit, Then we substract 600 to get again the same number. If we try with smaller numbers like 1413, we obtain 1613 which is 199 more then 1414. If we try with 1613, we obtain f(1613)=1613. With f(1614), we have 1414 which is the start of another period. The only possible answer are all the numbers between from 1414 to 1613. We have 200 fixed point.

For n less than 1214 one can not rewrite the first expression as you did in your first sentence.

Meike Rouwenhorst - 7 years, 8 months ago

Log in to reply

Ohh, thanks for pointing that out.My solution is indeed incorrect. Luckily it doesn't affect the solution. In that case would it be more appropriate to write down the function like this? f(n) = \left\{ \begin{array}{l} n - 600\\ f(n + 200)\\ f(f(n + 800)) \end{array} \right.\begin{array}{*{20}{c}} {n > 2013}\\ {1214 \le n \le 2013}\\ {n < 1214} \end{array}

Then we would say that the period for the second function is ruled by 1214+200n and 1413+200n. We obtain the same result as the answer for the problem, the only thing to add is that the new equation does not ever give a fixed point. (Proof needed).

Samuel Hatin - 7 years, 8 months ago

Log in to reply

It cannot give a fixed point since f ( n ) f(n) can only terminate at values 1414 \ge 1414 , so we must only check 1414 x 2012 1414\le x\le 2012 .

Daniel Chiu - 7 years, 8 months ago

Ohh, thanks for pointing that out.My solution is indeed incorrect.

Actually, it so happens that your first expression is correct, even if the thought process that led to it was incorrect.

Peter Byers - 7 years, 7 months ago

Lets take and example, and define 1613 1613 .

f ( 1613 ) = f ( f ( 2413 ) ) = f ( 1813 ) = f ( f ( 2613 ) ) = f ( 2013 ) = f ( f ( 2813 ) ) = f ( 2213 ) = 1613 f(1613) = f(f(2413)) = f(1813) = f(f(2613)) = f(2013) = f(f(2813)) = f(2213) = 1613 .

So we note that for n n in the function f ( n ) f(n) , there's a pattern of + 200 +200 . But remember that when n > 2013 n > 2013 , then f ( n ) = n 600 f(n) = n - 600 . Since with f ( 2013 ) f(2013) we will always reach f ( 2213 ) f(2213) , then the smaller possible value is f ( 2014 ) = 1414 f(2014) = 1414 .

Now we want to find which is the highest value, but we know we are talking about integers, and the higher case smaller than f ( 2014 ) f(2014) is f ( 2013 ) = f ( 2213 ) = 1613 f(2013) = f(2213) = 1613 . Hence, the highest possible value is 1613 1613 , and we know that from 1414 1414 to 1613 1613 there are 200 200 values, so the answer is 200 200 .

But there's still a question: Why can't we do better than 200 200 fixed points? Because if you start from any n n , the final value of f ( n ) f(n) will always be from 1414 1414 to 1613 1613 inclusive (unless you take n 2213 n\geq2213 , but clearly, that will not take us to anywhere).

PD: Can anyone teach me how to square my final answer (the code)?

You can use \boxed{answer}, as in 200 \boxed{200} .

Calvin Lin Staff - 7 years, 7 months ago

what do you mean square? like ^2?

Julio Reyes - 7 years, 7 months ago

Log in to reply

I mean like enclosing the solution in a box.

Diego E. Nazario Ojeda - 7 years, 7 months ago

Log in to reply

If you look at the formatting guide it gives you a basic list of things you can do with markdown and latex.

I think you mean like a code block?

- Solution Start
.
.
.
- End Solution

You just start a new paragraph with each line spaced 4 spaces from the edge. But I tried putting some latex code and it didn't work inside code blocks.

If you want to keep your latex code from going off the edge you can just do a line break inside the code with _\\ _ . That will put the rest of the code after it on the next line.

Julio Reyes - 7 years, 7 months ago
Venkatesh Varadan
Oct 17, 2013

when n=1, f(801), f(1601),f(1801),f(2001), f(2201) is equal to 1601 when n=2, f(802), f(1602), f(1802), f(2002), f(2202) is equal to 1602

f(n)=n for numbers from 1601 to 1800 after which it will repeat.

Total fixed points = 1800-1601+1=200

Timothy Zhou
Oct 16, 2013

Let's pick a number n and see run with it, seeing if we can get it back to n. Note that if we ever end iterating functions, our input will be >2013. So n<=2013 to begin. Also, n>2013-600 or we will never return to the number by subtracting 600. Ok. f(n)=> f(f(n+800))=>f(n+200); we don't want it to end yet so say n+200<=2013. Then this goes to f(f(n+1000))=>f(n+400). By same reasoning this goes to f(f(n+1200))=>f(n+600). Aha! Now let n+600>2013 and f(n+600)=n. So we know that n+600>2013 and n+400<=2013. There are 200 integers that are in this range.

A decrease is equivalent to 600 ... and an Increase equivalent to 800 in order to have f(x) = x ... we need 3 increases and 4 decreases

few points to note: 1. Initial decrease would resolve a value .... So we should have an increase initially 2. 1 increase followed by 2 decreases will also resolve a value ... So that should be the last step

Keeping this is mind ... we need the order of Increase/ Decrease as follows: ID ID IDD (3 increases 4 decreases)

now if the last 2 has to be decreases, the last decrease has to be over a minimum of 2014 ... which will give the final value as 1414 ... this will be the minimum value

Also, after the 2nd increase there should not be two simultaneous decreases ... which is the case if the 2nd increase leads to 2614 ... 2614 decreased to 2014 ... decreased to 1414 ... If the 2nd increase is to 2614, we should have started with 1614 .... (2 increases = + 1600 ... 1 decrease = - 600 ... net change +1000)

hence the range of values acceptable is:

1414 <= x < 1614 .... hence 200 values

Conjecturing a pattern out the blue:

Case 1: We assume that there are fixed points for n>2013 but since the function indicates that f(n) = n - 600, there wouldn't be any fixed points or values of n that will satisfy f(n) = n.

Case 2: We'll plug in some values, especially when n is less than or equal to 2013 and we will try to make a conjecture out of it.

Plug 1: Let n = 2013, 2012, 2011 This will yield f(2013) = f(f(2813)) = f(2213) = 1613 f(2012) = f(f(2812)) = f(2212) = 1612 f(2011) = f(f(2811)) = f(2211) = 1611

Plug 2: We will try to think a value wherein we don't have to use the function too much or use the function simply. This is when f(n + 800) = 2014, the first value where the function satisfies the function f(n) = n - 600. If we continue to use the function where f(n) = f(f(n+800)), the independent variable n simply increases by 200 constantly. So the number is n + 200 = 2014, n = 1814. So we will plug n = 1816, 1815, 1814. f(1816) = f(f(2616)) = f(2016) = 1416 f(1815) = f(f(2615)) = f(2015) = 1415 f(1814) = f(f(2614)) = f(2014) = 1414 And here we go...

Plug 3: Now let's try to plug in a value wherein we have to use the function more than once. Plug n = 1813, 1812, 1811 f(1813) = f(f(2613) = f(2013) = f(f(2813) = f(2213) = 1613. f(1812) = f(f(2612) = f(2012) = f(f(2812) = f(2212) = 1612. f(1811) = f(f(2611) = f(2011) = f(f(2811) = f(2211) = 1611. Now observe that the values 1613, 1612, and 1611 repeats again, therefore, we can conjecture that the values when n is less than or equal to 2013 will range from 1613 - 1414.

To find the fixed points, we have to repeat the sequence with their values respectively: n f(n) 2013 - 1814 1613 - 1414 1813 - 1614 1613 - 1414 1613 - 1414 1613 - 1414 1413 - 1214 1613 - 1414 ... and so on...

Observe also that the function and the value chosen have the same last two-digit numbers. Conclusion: There are 1613 - 1414 + 1 = 200 fixed points.

a solution in javascript

function f(n) {
    if (n > 2013) { 
        return n - 600; 
    } else {
        return f(f(n+800));
    }
}

fixedPoints = 0;
n=1;
tries=999999;

while (tries >0) {
    r = f(n);

    if (r == n) { 
        fixedPoints++;
        document.write(fixedPoints + "<br>");
    }

    tries--; 
    n++;
}

document.write("found " + fixedPoints);

Angel Leon - 7 years, 7 months ago

Log in to reply

Good solution, and definitely less work doing it this way. But I still find it more rewarding when I can come up with a solution mathematically. However, I still need to get my programming fix once in a while. If interested you can look into talentbuddy.co if you ever want to handle some problems specifically designed to be worked by programming. :)

Julio Reyes - 7 years, 7 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...