<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:bib="http://bibtexml.sf.net/" id="m10087">
  
  <name>Discrete-Time Convolution</name>
  
  <metadata>
  <md:version>2.17</md:version>
  <md:created>2001/06/13</md:created>
  <md:revised>2005/03/23 13:08:02 US/Central</md:revised>
  <md:authorlist>
      <md:author id="rars">
      <md:firstname>Ricardo</md:firstname>
      <md:othername>Anthony</md:othername>
      <md:surname>Radaelli-Sanchez</md:surname>
      <md:email>ricky@alumni.rice.edu</md:email>
    </md:author>
      <md:author id="richb">
      <md:firstname>Richard</md:firstname>
      <md:othername>G.</md:othername>
      <md:surname>Baraniuk</md:surname>
      <md:email>richb@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="mjhaag">
      <md:firstname>Michael</md:firstname>
      
      <md:surname>Haag</md:surname>
      <md:email>mjhaag@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="mariyah">
      <md:firstname>Mariyah</md:firstname>
      
      <md:surname>Poonawala</md:surname>
      <md:email>mariyah@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="richb">
      <md:firstname>Richard</md:firstname>
      <md:othername>G.</md:othername>
      <md:surname>Baraniuk</md:surname>
      <md:email>richb@rice.edu</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist>
    <md:keyword>convolution</md:keyword>
    <md:keyword>discrete time</md:keyword>
    <md:keyword>DT</md:keyword>
    <md:keyword>impulse response</md:keyword>
    <md:keyword>signals</md:keyword>
    <md:keyword>signals and systems</md:keyword>
  </md:keywordlist>

  <md:abstract>Convolution is a concept that extends to all systems that are
both linear and time-invariant (LTI). It will become apparent
in this discussion that this condition is necessary by
demonstrating how linearity and time-invariance give rise to
convolution.</md:abstract>
</metadata>
  
  
  <content>
    <section id="sec1">
      <name>Overview</name>
      <para id="p1">
	Convolution is a concept that extends to all systems that are
	both <term><cnxn document="m10084" strength="8">linear and
	time-invariant</cnxn></term> (<term>LTI</term>).  The idea of
	<term>discrete-time convolution</term> is exactly the same as
	that of <cnxn document="m10085" strength="8">continuous-time
	convolution</cnxn>.  For this reason, it may be useful to look
	at both versions to help your understanding of this extremely
	important concept.  Recall that convolution is a very powerful
	tool in determining a system's output from knowledge of an
	arbitrary input and the system's impulse response.  It will
	also be helpful to see convolution graphically with your own
	eyes and to play around with it some, so experiment with the
	<link src="http://www.jhu.edu/~signals">applets</link>
	available on the internet.  These resources will offer
	different approaches to this crucial concept.
      </para>
    </section>
    
    <section id="con_sum">
      <name>Convolution Sum</name>
      <para id="p_cint">
	As mentioned above, the convolution sum provides a concise,
	mathematical way to express the output of an LTI system based
	on an arbitrary discrete-time input signal and the system's
	response.  The <term>convolution sum</term> is expressed
	as

	<equation id="eq_csum">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="fn" class="discrete">y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>k</m:ci>
		</m:bvar>
		<m:lowlimit>
		  <m:apply>
		    <m:minus/>
		    <m:infinity/>
		  </m:apply>
		</m:lowlimit>
		<m:uplimit>
		  <m:infinity/>
		</m:uplimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci type="fn" class="discrete">x</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci type="fn" class="discrete">h</m:ci>
		    <m:apply>
		      <m:minus/>
		      <m:ci>n</m:ci>
		      <m:ci>k</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>
	
	As with continuous-time, convolution is represented by the
	symbol *, and can be written as

	<equation id="eq_convshort">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="fn" class="discrete">y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#convolve"/>
		<m:apply>
		  <m:ci type="fn" class="discrete">x</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci type="fn" class="discrete">h</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>
	
	By making a simple change of variables into the convolution
	sum,
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>k</m:ci>
	    <m:apply>
	      <m:minus/>
	      <m:ci>n</m:ci>
	      <m:ci>k</m:ci>
	    </m:apply>
	  </m:apply>
	</m:math>,
	we can easily show that convolution is
	<term>commutative</term>:
	
	<equation id="eq_convshort2">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#convolve"/>
		<m:apply>
		  <m:ci type="fn" class="discrete">x</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci type="fn" class="discrete">h</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	      <m:apply>
		<m:csymbol definitionURL="http://cnx.rice.edu/cd/cnxmath.ocd#convolve"/>
		<m:apply>
		  <m:ci type="fn" class="discrete">h</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
		<m:apply>
		  <m:ci type="fn" class="discrete">x</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>	
	For more information on the characteristics of convolution,
	read about the <cnxn document="m10088" strength="8">Properties
	of Convolution</cnxn>.
      </para>
    </section>


    <section id="sec2">
      <name>Derivation</name>
      <para id="p3">
	We know that any discrete-time signal can be represented by a
	summation of scaled and shifted discrete-time impulses.  Since
	we are assuming the system to be linear and time-invariant, it
	would seem to reason that an input signal comprised of the sum
	of scaled and shifted impulses would give rise to an output
	comprised of a sum of scaled and shifted impulse responses.
	This is exactly what occurs in <term>convolution</term>.
	Below we present a more rigorous and mathematical look at the
	derivation:
      </para>

      <para id="p3a">
	Letting <m:math><m:ci>ℋ</m:ci></m:math> be a DT LTI
	system, we start with the following equation and work our way
	down the convolution sum!

	<equation id="conv_der">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="fn" class="discrete">y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:ci type="fn" class="discrete">ℋ</m:ci>
		<m:apply>
		  <m:ci type="fn" class="discrete">x</m:ci>
		  <m:ci>n</m:ci>
		</m:apply>
	      </m:apply>
	      <m:apply>
		<m:ci type="fn" class="discrete">ℋ</m:ci>
		<m:apply>
		  <m:sum/>
		  <m:bvar>
		    <m:ci>k</m:ci>
		  </m:bvar>
		  <m:uplimit>
		    <m:infinity/>
		  </m:uplimit>
		  <m:lowlimit>
		    <m:apply>
		      <m:minus/>
		      <m:infinity/>
		    </m:apply>
		  </m:lowlimit>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:ci type="fn" class="discrete">x</m:ci>
		      <m:ci>k</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:ci type="fn" class="discrete">δ</m:ci>
		      <m:apply>
			<m:minus/>
			<m:ci>n</m:ci>
			<m:ci>k</m:ci>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>k</m:ci>
		</m:bvar>
		  <m:uplimit>
		  <m:infinity/>
		</m:uplimit>
		<m:lowlimit>
		  <m:apply>
		    <m:minus/>
		    <m:infinity/>
		  </m:apply>
		</m:lowlimit>
		<m:apply>
		  <m:ci type="fn" class="discrete">ℋ</m:ci>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:ci type="fn" class="discrete">x</m:ci>
		      <m:ci>k</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:ci type="fn" class="discrete">δ</m:ci>
		      <m:apply>
			<m:minus/>
			<m:ci>n</m:ci>
			<m:ci>k</m:ci>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>k</m:ci>
		</m:bvar>
		  <m:uplimit>
		  <m:infinity/>
		</m:uplimit>
		<m:lowlimit>
		  <m:apply>
		    <m:minus/>
		    <m:infinity/>
		  </m:apply>
		</m:lowlimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci type="fn" class="discrete">x</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci type="fn" class="discrete">ℋ</m:ci>
		    <m:apply>
		      <m:ci type="fn" class="discrete">δ</m:ci>
		      <m:apply>
			<m:minus/>
			<m:ci>n</m:ci>
			<m:ci>k</m:ci>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>k</m:ci>
		</m:bvar>
		  <m:uplimit>
		  <m:infinity/>
		</m:uplimit>
		<m:lowlimit>
		  <m:apply>
		    <m:minus/>
		    <m:infinity/>
		  </m:apply>
		</m:lowlimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci type="fn" class="discrete">x</m:ci>
		    <m:ci>k</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci type="fn" class="discrete">h</m:ci>
		    <m:apply>
		      <m:minus/>
		      <m:ci>n</m:ci>
		      <m:ci>k</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>

	Let us take a quick look at the steps taken in the above
	derivation.  After our initial equation, we using the DT
	<cnxn document="m10059" target="sifting" strength="7">sifting
	property</cnxn> to rewrite the function, 
	<m:math>
	  <m:apply>
	    <m:ci type="fn" class="discrete">x</m:ci>
	    <m:ci>n</m:ci>
	  </m:apply>
	</m:math>, as a sum of the function times the unit impulse.
	Next, we can move around the <m:math><m:mo>ℋ</m:mo></m:math>
	operator and the summation because
	<m:math>
	  <m:apply>
	    <m:ci type="fn" class="discrete">ℋ</m:ci>
	    <m:ci>˙</m:ci>
	  </m:apply>
	</m:math> is a linear, DT system.  Because of this linearity
	and the fact that 
	<m:math>
	  <m:apply>
	    <m:ci type="fn" class="discrete">x</m:ci>
	    <m:ci>k</m:ci>
	  </m:apply>
	</m:math> is a constant, we can pull the previous mentioned
	constant out and simply multiply it by 
	<m:math>
	  <m:apply>
	    <m:ci type="fn" class="discrete">ℋ</m:ci>
	    <m:ci>˙</m:ci>
	  </m:apply>
	</m:math>.  Finally, we use the fact that 
	<m:math>
	  <m:apply>
	    <m:ci type="fn" class="discrete">ℋ</m:ci>
	    <m:ci>˙</m:ci>
	  </m:apply>
	</m:math> is time invariant in order to reach our final state
	- the convolution sum!
      </para>


      <para id="p4">
	A quick graphical example may help in demonstrating why
	convolution works.
      </para>

      <figure id="figx">
	<media type="image/png" src="dtconv1e.png"/> 
	<caption>
	  A single impulse input yields the system's impulse response.
	</caption>
      </figure>

      <figure id="figx2">
	<media type="image/png" src="dtconv2e.png"/>
	<caption>
	  A scaled impulse input yields a scaled response, due to
	  the scaling property of the system's linearity.
	</caption>
      </figure>

      <figure id="figx3">
	<media type="image/png" src="dtconv3e.png"/>
	<caption>
	  We now use the time-invariance property of the system to
	  show that a delayed input results in an output of the same
	  shape, only delayed by the same amount as the input.
	</caption>
      </figure>

      <figure id="figx4">
	<media type="image/png" src="dtconv4e.png"/>
	  <caption>
	  We now use the additivity portion of the linearity
	  property of the system to complete the picture.  Since any
	  discrete-time signal is just a sum of scaled and shifted
	  discrete-time impulses, we can find the output from
	  knowing the input and the impulse response.
	</caption>
      </figure>
    </section>

   
    
    <section id="sec4">
      <name>Convolution Through Time (A Graphical Approach)</name>
      <para id="p7">
	In this section we will develop a second graphical
	interpretation of discrete-time convolution.  We will begin
	this by writing the convolution sum allowing
	<m:math>
	  <m:ci>x</m:ci>
	</m:math>
	to be a causal, length-<m:math><m:ci>m</m:ci></m:math> signal and
	<m:math>
	  <m:ci>h</m:ci>
	</m:math>
	to be a causal, length-<m:math><m:ci>k</m:ci></m:math>, LTI
	system.  This gives us the finite summation,

	<equation id="eq_eg2">
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:apply>
		<m:ci type="fn" class="discrete">y</m:ci>
		<m:ci>n</m:ci>
	      </m:apply>
	      <m:apply>
		<m:sum/>
		<m:bvar>
		  <m:ci>l</m:ci>
		</m:bvar>
		<m:lowlimit>
		  <m:cn>0</m:cn>
		</m:lowlimit>
		<m:uplimit>
		  <m:apply>
		    <m:minus/>
		  <m:ci>m</m:ci>
		    <m:cn>1</m:cn>
		  </m:apply>
		</m:uplimit>
		<m:apply>
		  <m:times/>
		  <m:apply>
		    <m:ci type="fn" class="discrete">x</m:ci>
		    <m:ci>l</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:ci type="fn" class="discrete">h</m:ci>
		    <m:apply>
		      <m:minus/>
		      <m:ci>n</m:ci>
		      <m:ci>l</m:ci>
		    </m:apply>
		  </m:apply>
		</m:apply>
	      </m:apply>
	    </m:apply>
	  </m:math>
	</equation>

	Notice that for any given 
	<m:math display="inline">
	  <m:ci>n</m:ci>
	</m:math>
	we have a sum of the products of
	<m:math display="inline">
	  <m:apply>
	    <m:ci>
	      <m:msub>
		<m:mi>x</m:mi>
		<m:mi>l</m:mi>
	      </m:msub>
	    </m:ci>
	  </m:apply>
	</m:math>
	and a time-delayed
	<m:math display="inline">
	  <m:apply>
	    <m:ci>
	      <m:msub>
		<m:mi>h</m:mi>		
		<m:mrow>
		  <m:mo>−</m:mo>
		  <m:mi>l</m:mi>
		</m:mrow>
	      </m:msub>
	    </m:ci>
	  </m:apply>
	</m:math>.  This is to say that we multiply the terms of
	<m:math display="inline">
	  <m:ci>x</m:ci>
	</m:math>
	by the terms of a time-reversed
	<m:math display="inline">
	  <m:ci>h</m:ci>
	</m:math>
	and add them up.
      </para>

      <para id="p8">
	Going back to the previous example:
      </para>

      <figure id="eg2_fig1">
	<media type="image/png" src="dtconv6e.png"/> 
	<caption>
	  This is the end result that we are looking to
	    find.
	</caption>
      </figure>

      <figure id="eg2_fig2">
	<media type="image/png" src="dtconv7e.png"/> 
	<caption>
	  Here we reverse the impulse response,
	  <m:math display="inline">
	    <m:ci>h</m:ci>
	  </m:math>
	  , and begin its traverse at time
	  <m:math display="inline">
	    <m:cn>0</m:cn>
	  </m:math>.
	</caption>
      </figure>

      <figure id="eg2_fig3">
	<media type="image/png" src="dtconv8e.png"/>
	<caption>
	  We continue the traverse.  See that at time
	  <m:math display="inline">
	      <m:cn>1</m:cn>
	  </m:math>
	  , we are multiplying two elements of the input signal by
	  two elements of the impulse response.
	</caption>
      </figure>

      <figure id="eg2_fig4a">
	<media type="image/png" src="dtconv9e.png"/>
      </figure>
      
      <figure id="eg2_fig4b">
	<media type="image/png" src="dtconv10e.png"/>
	<caption>
	  If we follow this through to one more step,
	  <m:math>
	    <m:apply>
	      <m:eq/>
	      <m:ci>n</m:ci>
	      <m:ci>4</m:ci>
	    </m:apply>
	  </m:math>, then we can see that we produce the same output
	  as we saw in the initial example.
	</caption>
      </figure>

      <!--
      <figure id='eg2_fig4c'>
	<media type="image/png" src="dconv8b_3.png"/>
	<caption>
	  See how this method follows through to produce the same
	  output we saw in the initial example.
	</caption>
      </figure>
      -->

      <para id="p8a">
	What we are doing in the above demonstration is reversing the
	impulse response in time and "walking it across" the input
	signal.  Clearly, this yields the same result as scaling,
	shifting and summing impulse responses.
      </para>
      
      <para id="p9">
	This approach of time-reversing, and sliding across is a
	common approach to presenting convolution, since it
	demonstrates how convolution builds up an output through time.
      </para>
    </section>
  </content>
</document>
