# Hard time figuring out whether the following random process is wide sense stationary

I'm dealing with a random process that's simply a square wave with pulse period T, where:

1. Each pulse takes either $$A$$ or $$-A$$ depending on a coin toss.
2. The wave is shifted by a random $$t_d$$ where $$t_d\sim{U(0, T)}$$

The first point can be also phrased as "during any time interval $$(n-1)T the signal's value $$A$$ or $$-A$$ is decided by tossing a fair coin. Now the problem asks to find the autocorrelation function and power spectral density (as if its actually wide sense stationary.)

I was able to conclude that for $$\tau>T$$ the two random variables $$X(t)$$ and $$X(t+\tau)$$ are essentially independent and hence the autocorrelation is the product of the expectation of each which is zero.

However, things get really complicated for $$\tau (especially because I'm unable to write a closed-form involving the two random variables (signal value and shift) for this random process).

Intuitively, for $$\tau>T$$ it's either that the two random variables are located in the same pulse or they are located in different pulses. The problem is, as far as I understand whether they are located in the same pulse or not depends on $$t$$ which makes me think that this isn't WSS in the first place.

• Your question title asks if the process is wide sense stationary, but the text asks what the autocorrelation is. Could you please edit your question to clarify what you really want? It is helpful to put the actual question you're asking in the question text -- i.e., instead of a declaratory sentence "the problem asks if the sky is blue", put in the question "so, is the sky blue?". Mar 12 at 15:45
• Thank you for your suggestion. The way I perceived it at the time of writing this is that they're both the same question (We need the ACF to prove that it's WSS). I had trouble both justifying that it's WSS (last line in my question) and finding the ACF. But the former seemed to be more fundamental to the problem. Mar 13 at 7:18

Let $$\{\mathcal Y(t): -\infty < t < \infty\}$$ denote a random process defined by $$\mathcal Y(t) = \sum_{k=-\infty}^\infty \mathcal B_k p\left({t-kT}\right), \ -\infty < t < \infty\tag{1}$$ where the $$\mathcal B_k$$'s are independent random variables taking on values $$\pm A$$ with equal probability $$\frac 12$$, and $$p(t) = \begin{cases}1, & 0 \leq t < T,\\0, &\text{otherwise}\end{cases}$$ is the rectangular pulse. Thus, this process is the pulse train of rectangular pulses of duration $$T$$ and where the amplitude of each successive pulse is randomly chosen as $$\pm A$$. Note that for any fixed real number $$t$$, one and only one of the $$p$$'s in $$(1)$$ has value $$1$$. Thus, for every real number $$t$$, that infinite sum in $$(1)$$ simplifies to just one of the $$\mathcal B_k$$'s: for all $$t$$ satisfying $$kT \leq t < (k+1)T$$, $$\mathcal Y(t)$$ equals $$\mathcal B_k$$. Now, although $$E[\mathcal B_k]=0, E[\mathcal B_k^2]=A^2$$ for all $$k$$, and $$E[\mathcal B_k\mathcal B_{k^\prime}]=0$$ for all $$k^\prime \neq k$$, $$\{\mathcal Y(t)\}$$ is not a wide-sense-stationary process since $$E[\mathcal Y(t)\mathcal Y(t+\tau)]$$ depends on both $$t$$ and $$\tau$$, and not just on $$\tau$$ only as is needed for wide-sense stationarity.

Let $$\mathcal T \sim \mathcal U[0,T)$$ be a random variable independent of all the $$B_k$$'s and consider the random process $$\{\mathcal X(t): -\infty < t < \infty\}$$ defined by $$\mathcal X(t) = \mathcal Y(t- \mathcal T) = \sum_{k=-\infty}^\infty \mathcal B_k p\left({t - \mathcal T -kT}\right), \ -\infty < t < \infty.\tag{2}$$ Note that all the "bit boundaries", which are at integer multiples of $$T$$ in the $$\{Y(t)\}$$ process have been displaced to the right by the same random amount $$\mathcal T$$ in the $$\{X(t)\}$$ process. In other words, for every $$k^\prime \neq k$$ (including as special cases $$k^\prime = k \pm 1$$, the pulses $$p(t-\mathcal T - kT)$$ and $$p(t-\mathcal T - k^\prime T)$$ are non-overlapping pulses. Therefore, as with $$(1)$$, for each real number $$t$$, the infinite sum in $$(2)$$ simplifies to $$\mathcal B_k$$ where $$k$$ is the unique integer such that $$kT + \mathcal T \leq t < (k+1)T + \mathcal T$$. Put another way, for each real number $$t$$, the location of the next bit boundary to the right of $$t$$ is uniformly distributed on $$(t,t+T]$$ and the previous bit boundary to the left of $$t$$ is uniformly distributed on $$[T-t,t)$$. These two locations are related random variables in that they must be $$T$$ seconds apart.

We have \begin{align} E[\mathcal X(t)] &= E\left[\sum_{k=-\infty}^\infty \mathcal B_k p\left({t - \mathcal T -kT}\right)\right]\\ &= \sum_{k=-\infty}^\infty E[\mathcal B_k]E\left[p\left({t - \mathcal T -kT}\right)\right]\\ &= 0 &\text{since} ~E[\mathcal B_k]=0. \end{align} To answer another follow-up question from the OP in the comments below, note that it doesn't matter diddlysquat what the value of $$E\left[p\left({t - \mathcal T -kT}\right)\right]$$ is (we know that the expectation must have finite value): since $$E[\mathcal B_k]=0$$ and $$E\left[p\left({t - \mathcal T -kT}\right)\right]$$ is finite, the product $$E[\mathcal B_k]E\left[p\left({t - \mathcal T -kT}\right)\right]$$ is guaranteed to be $$0$$, and the sum of a (countably) infinite number of $$0$$'s is $$0$$.

What about $$E[\mathcal X(t)\mathcal X(t+\tau)]$$? Well, if $$|\tau| \geq T$$, then it must be that $$\mathcal X(t) = \mathcal B_k$$ and $$\mathcal X(t+\tau) = \mathcal B_{k^\prime}$$ for some $$k^\prime \notin \{k, k-1, k+1\}$$ and so $$E[\mathcal X(t)\mathcal X(t+\tau)] = E[\mathcal B_k\mathcal B_{k^\prime}]=0 ~\text{whenever}~ |\tau| \geq T. \tag{3}$$ What happens when $$|\tau| < T$$? Well, if $$\tau = 0$$, $$E[\mathcal X(t)\mathcal X(t+\tau)] = E[\mathcal X^2(t)] = A^2$$. For each fixed $$\tau$$ such that $$0 < |\tau| < T$$, with probability $$\frac{|\tau|}{T}$$, there is a bit boundary separating $$t$$ and $$\tau$$, and with probability $$1-\frac{|\tau|}{T}$$, there is no bit boundary separating $$t$$ and $$\tau$$. Thus, whenever $$|\tau| < T$$, $$\mathcal X(t)\mathcal X(t+\tau) = \begin{cases} \mathcal B_k, & \text{with probability} ~1-\frac{|\tau|}{T},\\ \mathcal B_k\mathcal B_{k\pm 1}, & \text{with probability} ~\frac{|\tau|}{T}, \end{cases}$$ giving that for $$|\tau| < T$$, \begin{align}E[\mathcal X(t)\mathcal X(t+\tau)] &= A^2\cdot \left(1 - \frac{|\tau|}{T}\right) + 0\cdot \frac{|\tau|}{T}\\ &= A^2\cdot \left(1 - \frac{|\tau|}{T}\right). \tag{4} \end{align} Thus, $$E[\mathcal X(t)\mathcal X(t+\tau)]$$ is a function of $$\tau$$ alone without any dependence on $$t$$, and we conclude that $$\{\mathcal X(t)\}$$ is a wide-sense stationary process, Note that the autocorrelation function is the familiar symmetric triangle with apex $$A^2$$ at $$\tau=0$$ and base the interval $$[-T, T]$$.

Don't like the argument above? (I don't think the OP does). OK, let's do it by the book and the hard way.

\begin{align} E[\mathcal X(t)\mathcal X(s)] &= E\left[\sum_{k=-\infty}^\infty \mathcal B_k p\left({t - \mathcal T -kT}\right)\sum_{k^\prime=-\infty}^\infty \mathcal B_{k^\prime} p\left({s - \mathcal T -k^\prime T}\right)\right]\\ &= E\left[\sum_{k=-\infty}^\infty \sum_{k^\prime=-\infty}^\infty \mathcal B_k p\left({t - \mathcal T -kT}\right) \mathcal B_{k^\prime} p\left({s - \mathcal T -k^\prime T}\right)\right]\\ &= \sum_{k=-\infty}^\infty \sum_{k^\prime=-\infty}^\infty E\left[\mathcal B_k p\left({t - \mathcal T -kT}\right) \mathcal B_{k^\prime} p\left({s - \mathcal T -k^\prime T}\right)\right]\\ &= \sum_{k=-\infty}^\infty \sum_{k^\prime=-\infty}^\infty E[\mathcal B_k \mathcal B_{k^\prime}]E\left[ p\left({t - \mathcal T -kT}\right)p\left({s - \mathcal T -k^\prime T}\right)\right]\tag{5}\\ &= \sum_{k=-\infty}^\infty E[\mathcal B_k^2]E\left[ p\left({t - \mathcal T -kT}\right)p\left({s - \mathcal T -kT}\right)\right]\tag{6} \end{align} where the double sum in $$(5)$$ reduces to the single sum in $$(6)$$ because $$E[\mathcal B_k \mathcal B_{k^\prime}] = 0$$ unless $$k^\prime = k$$ when $$E[\mathcal B_k \mathcal B_{k^\prime}] = E[\mathcal B_k^2] = A^2$$. Thus, we have that \begin{align} E[\mathcal X(t)\mathcal X(s)] &= A^2 \sum_{k=-\infty}^\infty E\left[ p\left({t - \mathcal T -kT}\right)p\left({s - \mathcal T -kT}\right)\right].\tag{7} \end{align} Since $$p\left({t - \mathcal T -kT}\right)p\left({s - \mathcal T -kT}\right)$$ is a function of the random variable $$\mathcal T \sim \mathcal U[0,T)$$, we get \begin{align} E\left[ p\left({t - \mathcal T -kT}\right)p\left({s - \mathcal T -kT}\right)\right] &= \int_0^T p\left({t - u -kT}\right)p\left({s - u -kT}\right) \cdot \frac 1T \, \mathrm du. \end{align} Make a change of variables in the integral by setting $$v=t-u-kT$$ which changes the limits from $$0$$ and $$T$$ to $$t-kT$$ and $$t-(k+1)T$$ respectively, tells us that $$\mathrm du = -\mathrm dv$$ and so $$E\left[ p\left({t - \mathcal T -kT}\right)p\left({s - \mathcal T -kT}\right)\right] = \int_{t-(k+1)T}^{t-kT} p\left({v}\right)p\left({s - t+v}\right) \cdot \frac 1T \, \mathrm dv.\tag{8}$$ Substituting $$(8)$$ into $$(7)$$ and combining the sum of the integrals over contiguous non-overlapping intervals into a single integral over the entire real line, we get $$E[\mathcal X(t)\mathcal X(s)] = \frac{A^2}{T}\int_{-\infty}^\infty p\left({v}\right)p\left({s - t+v}\right) \, \mathrm dv$$ where the integral is readily recognized as the autocorrelation function of the pulse $$p(\cdot)$$ evaluated at $$s-t$$, the difference of the two arguments $$s$$ and $$t$$. Thus, we have $$E[\mathcal X(t)\mathcal X(s)] = \begin{cases} A^2\cdot \left(1 - \dfrac{|s-t|}{T}\right), & |s-t| \leq T,\\ 0, &|s-t| > T, \end{cases} \tag{9}$$ as we previously found in $$(3)$$ and $$(4)$$. Disbelievers should write $$t+\tau$$ for $$s$$ in $$(9)$$ to verify for themselves that $$(9)$$ is indeed the same as $$(3)$$ and $$(4)$$.

• After revisiting the answer. I'm really not so comfortable with how we no longer started considering the pulse whenever we needed to express $X(t)$. As far as I know its a function of a random variable so should a random variable itself. In other words, I'm having trouble generalizing "Thus, for every real number 𝑡, that infinite sum in (1) simplifies to just one of the..." to the case where the random shift is involved. This issue is solved is the expectation of the pulse is 1 which I can't see being the case. Mar 15 at 18:19
• @Essam See edited answer. Mar 15 at 19:25
• Y'know, I was going by "if knowing what time it is doesn't tell you anything about the probabilities, then it's WSS". Which is much shorter, but does lack rigor. Mar 16 at 0:58
• @Dilip I'm only slightly confused because in this case we didn't need the nice closed form that considered the randomly-shifted pulse in the first place. Right? This would feel natural if the expectation of the randomly-shifted pulse is 1. Mar 16 at 6:38
• That is, why didn't we consider the closed form formulation whenever plugging in the ACF but did so when finding the expectation of the random process? Mar 16 at 6:41

especially because I'm unable to write a closed-form involving the two random variables (signal value and shift) for this random process

Well, then let's introduce a random variable (RV) for both the signal value and the shift! It's customary to give RVs capital letters, so I'll go ahead and rename your $$t_d$$ (also, because the index might end up confusing us):

• $$S\sim\mathcal U(0, T)$$: the shift
• $$V_i \sim U\{-A, A\}, i = -\infty, \ldots, -1, 0, 1, \ldots, \infty$$: the sequence of random values

What we want is a stochastic signal over a continuous time $$t$$, $$X(t)$$, so let's find a mapping between continuous times and the discrete time step index $$i$$:

$$i = \left\lfloor \frac{t-S}T \right\rfloor$$

Equipped like this, we can write

$$X(t) = V_{\left\lfloor \frac{t-S}T \right\rfloor}.$$

So, that's a closed form!

So, let's play a bit with $$X(t)X(t+\tau)$$:

$$X(t)X(t+\tau) = V_{\left\lfloor \frac{t-S}T \right\rfloor} V_{\left\lfloor \frac{t-S+\tau}T \right\rfloor}$$

There's two cases, for which this product takes different results, $$A^2$$ or $$-A^2$$:

1. case:$$V_{\left\lfloor \frac{t-S}T \right\rfloor} = V_{\left\lfloor \frac{t-S+\tau}T \right\rfloor} ,$$
2. case: $$V_{\left\lfloor \frac{t-S}T \right\rfloor} \ne V_{\left\lfloor \frac{t-S+\tau}T \right\rfloor} .$$

For the first case, we need to think about how that can happen: 1.1., it can happen because two consecutive values $$V_i$$ and $$V_{i+1}$$ happen to be identical, and we "slipped across" the period boundary, or 1.2. because we stayed "within the period"

For the second case, 2., it must be that two consecutive values are different, AND we slipped across the boundary.

So:

• Write down the mathematical condition for $$t$$, $$S$$ and $$T$$ under which "we slip across the period boundary"
• Write down how probable cases 1.. and 2. are¹! Then:
• Write down $$E(X(t)X(t-\tau))$$ based on that.

PS: maybe it's easier to start out by setting $$T=1$$ and $$A=1$$, and arguing that if things are WSS, then you can just scale and stretch the ACF as you wish to reintroduce arbitrary periods and amplitudes.

¹: You can do that by calculating the probability of case 2., and knowing that case 1. has $$1-P(\text{case 2})$$, or you can sum the probabilities of case 1.1 and 1.2 and find the probability of case 2 from these. Whatever you find easier!