What is a mathematical expression for the sequence $\{1,1,-1,-1,1,1,-1,-1,\dots\}$, that is $1$ and $-1$, two at a time alternating?
-
1Do you means the sequence of $1$s and $-1$s, two at a time alternating? – 2'5 9'2 Mar 13 '16 at 21:20
-
Try working with powers of $-1$. You have $-1$ to an even power is positive one, while $-1$ to an odd power is negative one. Now, try defining the exponent in a convenient way so that it goes even, even, odd, odd, etc... perhaps a quadratic might work well. (what does $(n^2+n)/2$ look like in terms of even and odd numbers as a sequence?) – JMoravitz Mar 13 '16 at 21:20
-
@alex.jordan Yes – Postskjerm Mar 13 '16 at 21:22
7 Answers
Starting with $n=0$, these all work. $$\begin{align} a_n&=(-1)^{n(n-1)/2}\\ a_n&=(-1)^{\left\lfloor\frac{n}{2}\right\rfloor}\\ a_n&=\cos(n\pi/2)+\sin(n\pi/2)\\ a_n&=\sqrt{2}\cdot\sin\big((2n+1)\tfrac{\pi}4\big) \end{align}$$
If I'm being honest, being able to come up with these things for me comes from having seen them before. But in each case you can think about the pattern of even/odd exponents for $-1$ or the periodicity mod 4 if you were trying to build these having no prior knowledge.
$\color{blue}{Update}:$ And modified from this post so it starts $a_0=1$, $$\begin{align} a_n&=\sqrt{2}\cdot\cos\big((2n-1)\tfrac{\pi}4\big) \end{align}$$
-
-
-
@Elimination Sorry, I just reordered and may have screwed up your reference. – 2'5 9'2 Mar 13 '16 at 21:53
-
1
-
1
-
-
@alex.Jordan: I added the cosine version from an old post to group them all together. I hope you don't mind. – Tito Piezas III Dec 14 '16 at 11:58
-
1There seems to be a problem with the sine version, its absolute vaules cannot be one. Should it maybe be $\sqrt{2}$ instead of $\frac{1}{\sqrt{2}}$? – Matthias Klupsch Dec 14 '16 at 12:09
-
@MatthiasKlupsch: I took the liberty of fixing the sine version. (It was already $\frac{1}{\sqrt{2}}$ when I first saw it.) – Tito Piezas III Dec 14 '16 at 13:13
-
@Tito, Matthias Good catch with $\sqrt{2}$. Tito, I think the cosine needs adjustment. The other sequences here begin indexing at $n=0$, and with indexing that begins at $n=0$, the cosine sequence you added is ${-1,1,1,-1,-1,\ldots}$. I think one way to adjust it is to drop the minus sign and shift the $2n+1$ to $2n-1$. – 2'5 9'2 Dec 14 '16 at 17:44
-
-
@alex.Jordan I've also asked a new question generalizing the phenomenon of using triangular numbers on $(-1)^n$. Kindly see this post. – Tito Piezas III Dec 15 '16 at 03:32
The sequence $a_0=1$, $a_1=1$, $a_2=-1$, $a_3=-1$, $a_4=1$ and so on satisfies the recursion $$ a_0=1,\quad a_1=1,\qquad a_{n+2}=-a_n $$ so its characteristic equation is $t^2+1=0$. Thus the general solution is of the form $$ xi^n+y(-i)^n $$ The initial conditions tell that $x+y=1$ and $xi-yi=1$, thus $$ \begin{cases} x+y=1\\[4px] x-y=-i \end{cases} $$ that gives $$ x=\frac{1-i}{2},\quad y=\frac{1+i}{2} $$ Since $i=\cos\frac{\pi}{2}+i\sin\frac{\pi}{2}$, we can write \begin{align} a_n &=\frac{1}{2}\bigl( (1-i)(\cos\tfrac{n\pi}{2}+i\sin\tfrac{n\pi}{2})+ (1+i)(\cos\tfrac{n\pi}{2}-i\sin\tfrac{n\pi}{2}) \bigr)\\[6px] &=\cos\frac{n\pi}{2}+\sin\frac{n\pi}{2} \end{align}
- 238,574
A rather exotic formula uses tribonacci numbers $T_n$,
$$a_n = -(-1)^{T_n} = 1,1,-1,-1,1,1,-1,-1,\dots$$
where,
$$T_n=\sum_{k=0}^n\sum_{j=0}^{n-k}\tbinom{n-k}{j}\tbinom{j}{k-j}=1, 1, \color{blue}{2, 4}, 7, 13, \color{blue}{24, 44}, 81, 149, \color{blue}{274, 504},\dots$$
and we define $T_0=1$.
P.S. The above has period $4$. For other periods which uses the Fibonacci numbers etc, see this post.
- 54,565
You can simply interpolate$(1,1,-1,-1)$, and then use $x=n\bmod4$:
$$a_n=\frac{2}{3}(n\bmod4)^3-5(n\bmod4)^2+\frac{31}{3}(n\bmod4)-5$$
- 43,109
I interpret your question as: "How can we define this sequence formally?"
A more general question is: how can we define $x = (a,a,b,b,a,a,b,b,a,a,\ldots)$ formally?
If you prefer the convention that sequences start at $0$, use:
$$x_i = \left\{\begin{aligned} &a, && \mbox{if} \;{\left\lfloor\frac{i}{2}\right\rfloor} \in 2\mathbb{Z}\\ &b, && \mbox{if} \;{\left\lfloor\frac{i}{2}\right\rfloor} \in 2\mathbb{Z}+1 \end{aligned} \right.$$
If you prefer the convention that sequences start at $1$, use:
$$x_i = \left\{\begin{aligned} &a, && \mbox{if} \;{\left\lfloor\frac{i}{2}\right\rfloor} \in 2\mathbb{Z}+1\\ &b, && \mbox{if} \;{\left\lfloor\frac{i}{2}\right\rfloor} \in 2\mathbb{Z} \end{aligned} \right.$$
The above definitions are "set-theoretic." But we can also give an "algebraic" definition. This has the benefit that our numbering conventions become irrelevant. We begin by telling the reader that by $\sum$, we mean concatenation of sequences. Then we write: $$x = \sum_{n \in \mathbb{N}} (a,a,b,b)$$
- 67,744
The sequence of exponents of $-1$ (i.e. $0,0,1,1,0,0,1,1,\cdots$ but also $0,0,1,1,2,2,3,3\cdots$) can follow the recurrence
$$e_{n+2}=e_n+1,\\e_0=e_1=0.$$
The general solution is given by
$$e_n=\frac n2+c_0+c_1(-1)^n$$ and you can determine the constants from the initial conditions, giving
$$e_n=\frac n2-\frac{1-(-1)^n}4.$$
The method generalizes to runs of length $k$, involving the $k^{th}$ roots of the unit.
The sequence $\{a_0,a_1,a_2, \dots \}$ with $a_n$ defined as the coefficient of the $n$th power of $x$ in the expansion of $(1+x)/(1+x^2)$ will do.
- 1,192
- 1
- 6
- 19