on december31, 1995, paul invested $2000 in a stock. his stocker gains 20% ever odd month (jan, march, may..) and loses 15% every even month (feb, april, june...)

it says write a piecewise defined function for the value of the stocker n months after the original investment, n is a whole number.
how do i write a piecewise function?

A piecewise-defined function changes the formula or its value at one or more points of the domain. In your case, the function will be a series of steps. You do not say if the stock gains steadily during odd months or increases abruptly at the end of the month, and similarly falls steadily of abuptly in even months. If the value changes suddenly, it would not be a continuous function. Let's assume its value stays constant during each month and changes at the end of that month. In that case:

For month 1, the value is 2000.00
During month 2, the value is
2000. x 1.2 = 2400.00
During month 3, the value is
2400.00 x (0.85) = 2040.00
During month 4, the value is
2040 x (1.2) = 2448.00

Try to express those values in terms of n.

To write a piecewise function for the value of the stock after n months, you need to consider the different cases based on whether n is odd or even.

Let's break it down step by step:

1. Determine the value of the stock after the first month (n = 1):
- Given that the stock gains 20% in odd months, the value after one month would be 100% + 20% = 120% of the initial investment, which is $2000. Therefore, the value after one month is $2000 * 1.2 = $2400.

2. Determine the value of the stock after the second month (n = 2):
- Since the stock loses 15% in even months, the value after the second month would be 100% - 15% = 85% of the value after the first month ($2400). Therefore, the value after two months is $2400 * 0.85 = $2040.

3. Repeat the same process for the third and fourth months (n = 3 and n = 4):
- In the third month (n = 3), the stock gains 20% again, so the value would be $2040 * 1.2 = $2448.
- In the fourth month (n = 4), the stock loses 15% again, so the value would be $2448 * 0.85 = $2081.20.

Based on the pattern, you can write a piecewise defined function for the value of the stock after n months:

- For odd values of n (n = 1, 3, 5, 7, ...), the function would be:
f(n) = 2000 * (1.2)^(n/2) if n is odd.

- For even values of n (n = 2, 4, 6, 8, ...), the function would be:
f(n) = 2000 * (0.85)^(n/2) if n is even.

This piecewise function takes into account the alternating percentages of gains and losses for odd and even months, respectively.