# Is $\delta(n) = u(n) - u(n-1)$?

In my text book, Digital Signal Processing, Principles, Algorithms, and Applications by John Proakis, it asks the question to show how $$\delta(n) = u(n) - u(n-1).$$

I can understand how this is true if $$n$$ is an integer, but sometimes I see the step function as a continuous line instead of a fixed point at an instant. In that case, is it incorrect to think of $$u(n)$$ as something continuous?

• Does the text in question (who is the author, by the way?) use a very common (but by no means universal) notational convention: $x[n]$ means the $n$-th sample of a continuous-time signal $x(t)$, that is, $x[n] = x(nT)$ where $T$ is the time interval between samples? Or does the author routinely use $x(n)$ to mean either the $n$-th sample or the value of $x(t)$ at time $t = n$, because he, like Humpty Dumpty, scornfully believes that "When I use a word, it means just what I choose it to mean — neither more nor less." ?? Feb 25, 2013 at 2:54
• @DilipSarwate That's what I'm confused about. It seems to switch back and forth.
– Ci3
Feb 25, 2013 at 5:00
• "... it seems to switch back and forth." Well, then, play Follow-my-leader and give the proof that makes sense, prefacing your answer by something like: "In this answer, I use $u$ and $\delta$ to mean sequences with $n$-th elements $u(n)$ and $\delta(n)$ where $n$ is an integer." Then write out your proof (probably just one or two lines) and end with a coda saying that the result to be proved is not correct if $u$ and $\delta$ are interpreted as continuous-time functions. That way you have C-ed YA against TAs eager to knock a few points off. Feb 25, 2013 at 12:17
• The question only makes sense if it is referring to discrete sequences and, as Dilip said, the "n" terminology almost always implies discrete sequences, so I would assume that they mean discrete sequences. Feb 25, 2013 at 14:32

You are correct that this equality is only true when $$n$$ is an integer.

Explanation

There are in fact 2 different flavors of the delta function.

1. The Dirac delta function is defined as $$\delta (x) = 0 \quad x \neq 0$$ $$\delta (x) \neq 0 \quad x = 0$$ $$\int_{-\infty}^{\infty} \delta (x)dx = 1$$ You can sense from at least the third part of this definition that the Dirac delta (impulse function) is a continuous function over all $$\mathbb R$$. It can also have meaning in $$\mathbb C$$ and in multiple dimensions. Under this definition, the function is only non-zero exactly at $$x=0$$. It's 0 everywhere else including $$x = 0.5$$, $$x = 0.00000001$$, $$x = \pi$$, etc. In this case $$u(x)-u(x-1) = rect(x-0.5) \neq \delta (x)$$

2. The Kronecker delta function is a function of two discrete variables and is defined as $$\delta_{i,j} = \begin{cases} 1 \quad &i=j \\ 0 \quad &i \neq j \end{cases}$$ A special case of the Kronecker delta function is known as the unit sample function $$\delta[n] \equiv \delta_{n,0}$$ which comes up in digital signal processing often. This can be defined more simply as $$\delta[n] = \begin{cases} 1 \quad &n=0 \\ 0 \quad &n \text{ is another integer} \end{cases}$$ You can see from this definition that the Kronecker Delta function and therefore the unit sample function are discrete functions that only have meaning as functions of integers. For example, $$\delta[0.5]$$ does not make any sense because 0.5 does not belong to an integer set. In this case $$u[n]-u[n-1] = \delta [n]$$ where the unit step function $$u[n]$$ is a sampled version of the continuous unit step function with sample rate $$T$$. $$u[n] = u(nT)$$

To alleviate some of the confusion, authors tend to use the variable $$n$$ when dealing with discrete-time functions, and the variable $$t$$ when dealing with continuous-time functions. You will also notice from my answer that people also often use brackets instead of parentheses when dealing with discrete functions, although Proakis does not do this. For this question you need to assume $$n$$ is an integer based on the fact you're being asked to prove the equality.

• The Dirac Delta is not defined to have value $\infty$ at $0$, that is, $\delta(0)=\infty$ is an incorrect statement. Please edit your answer. -1 pending corrections. Oct 27, 2021 at 22:48
• @Dilip you’re right if you’re being rigorous mathematically, but the definition I gave is pretty common, including on Wikipedia. Anyway I edited the answer to be more accurate
– Ryan
Oct 27, 2021 at 23:10