Question

# Find a recurrence relation satisfied by this sequence. a_{n}=n+(-1)^{n}ZS

Sequences
Find a recurrence relation satisfied by this sequence.
$$\displaystyle{a}_{{{n}}}={n}+{\left(-{1}\right)}^{{{n}}}$$

2021-09-14
Given:
$$\displaystyle{a}_{{{n}}}={n}+{\left(-{1}\right)}^{{{n}}}$$
Let us first determine the first term by replacing n in the given expression for $$\displaystyle{a}_{{{n}}}$$ by 0:
$$\displaystyle{a}_{{{0}}}={0}+{\left(-{1}\right)}^{{{0}}}={0}+{1}={1}$$
Let us similarly determine the next few terms as well:
$$\displaystyle{a}_{{{1}}}={1}+{\left(-{1}\right)}^{{{1}}}={1}-{1}={0}={a}_{{{0}}}-{1}$$
$$\displaystyle{a}_{{{2}}}={2}+{\left(-{1}\right)}^{{{2}}}={2}+{1}={3}={a}_{{{1}}}+{3}$$
$$\displaystyle{a}_{{{3}}}={3}+{\left(-{1}\right)}^{{{3}}}={3}-{1}={2}={a}_{{{2}}}-{1}$$
$$\displaystyle{a}_{{{4}}}={4}+{\left(-{1}\right)}^{{{4}}}={4}+{1}={5}={a}_{{{3}}}+{3}$$
$$\displaystyle{a}_{{{5}}}={5}+{\left(-{1}\right)}^{{{5}}}={5}-{1}={4}={a}_{{{4}}}-{1}$$
$$\displaystyle{a}_{{{6}}}={6}+{\left(-{1}\right)}^{{{6}}}={6}+{1}={7}={a}_{{{5}}}+{3}$$
We note that each term is the previous term increased by 3 if n is even:
If n even: $$\displaystyle{a}_{{{n}}}={a}_{{{n}-{1}}}+{3}$$
We note that each term is the previous term decreased by 1 if n is odd:
If n odd: $$\displaystyle{a}_{{{n}}}={a}_{{{n}-{1}}}-{1}$$
Thus a recurrence relation for $$\displaystyle{a}_{{{n}}}$$ is then:
$$\displaystyle{a}_{{{0}}}={1}$$
$$\displaystyle{a}_{{{n}}}={b}{e}{g}\in{\left\lbrace{c}{a}{s}{e}{s}\right\rbrace}{a}_{{{n}-{1}}}+{3}&{\quad\text{if}\quad}\ {n}\ {e}{v}{e}{n}\backslash{a}_{{{n}-{1}}}-{1}&{\quad\text{if}\quad}\ {n}\ {o}{d}{d}{e}{n}{d}{\left\lbrace{c}{a}{s}{e}{s}\right\rbrace}$$
Note: There are infinitely many different recurence relations that satisfy any sequence.