<?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:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="m10780">

  <name>Circular Shifts</name>

  <metadata>
  <md:version>2.5</md:version>
  <md:created>2002/08/02</md:created>
  <md:revised>2005/06/24 19:40:16.395 GMT-5</md:revised>
  <md:authorlist>
      <md:author id="jrom">
      <md:firstname>Justin</md:firstname>
      
      <md:surname>Romberg</md:surname>
      <md:email>jrom@rice.edu</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist>
    <md:maintainer id="rha">
      <md:firstname>Roy</md:firstname>
      
      <md:surname>Ha</md:surname>
      <md:email>rha@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer id="jrom">
      <md:firstname>Justin</md:firstname>
      
      <md:surname>Romberg</md:surname>
      <md:email>jrom@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>circular shift</md:keyword>
    <md:keyword>circular shifts</md:keyword>
    <md:keyword>DFT</md:keyword>
    <md:keyword>discrete time</md:keyword>
    <md:keyword>fourier</md:keyword>
    <md:keyword>fourier transform</md:keyword>
  </md:keywordlist>

  <md:abstract>The module looks at circular shifting and how it is can be used as a tool to represent the shifting of a periodic sequence.</md:abstract>
</metadata>

  <content>

    <para id="para1">
      The many properties of the <cnxn document="m10784" target="dtfs" strength="8">DFT</cnxn> become really straightforward
      (<emphasis>very</emphasis> similar to the <cnxn document="m10496" strength="8">Fourier Series</cnxn>) once we have once concept
      down: <term>Circular Shifts</term>.
    </para>

    <section id="sec1">
      <name>Circular shifts</name>

      <para id="para2">
        We can picture <cnxn document="m10744" strength="8">periodic</cnxn> sequences as having discrete
        points on a circle as the domain
      </para>

      <figure id="fig1">
        <media type="image/png" src="fig1.png"/>
      </figure>

      <para id="para3">
        Shifting by <m:math><m:ci>m</m:ci></m:math>,
        <m:math>
          <m:apply>
            <m:ci type="fn">f</m:ci>
            <m:apply>
              <m:plus/>
                <m:ci>n</m:ci>
                <m:ci>m</m:ci>
            </m:apply>
          </m:apply>
        </m:math>, corresponds to rotating the cylinder
        <m:math><m:ci>m</m:ci></m:math> notches ACW (counter
        clockwise).  For
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>m</m:ci>
	    <m:cn>-2</m:cn>
	  </m:apply>
	</m:math>, we get a shift equal to that in the following
	illustration: 
      </para>

      <figure id="fig2">
        <media type="image/png" src="fig2.png"/>
        <caption>for
          <m:math>
            <m:apply>
              <m:eq/>
                <m:ci>m</m:ci>
                <m:cn>-2</m:cn>
            </m:apply>
          </m:math>
        </caption>
      </figure>

      <figure id="fig3">
        <media type="image/png" src="fig3.png"/>
      </figure>

      <para id="para4">
        To cyclic shift we follow these steps:
      </para>

      <para id="para4a">
        1) Write
        <m:math>
          <m:apply>
            <m:ci type="fn">f</m:ci>
            <m:ci>n</m:ci>
          </m:apply>
        </m:math>
        on a cylinder, ACW
      </para>

      <figure id="fig4">
        <media type="image/png" src="fig4.png"/>
        <caption>
          <m:math>
            <m:apply>
              <m:eq/>
                <m:ci>N</m:ci>
                <m:cn>8</m:cn>
            </m:apply>
          </m:math></caption>
      </figure>

      <para id="para5">
        2) To cyclic shift by <m:math><m:ci>m</m:ci></m:math>, spin
           cylinder m spots ACW
        <m:math display="block">
          <m:apply>
	    <m:ci><m:mo>→</m:mo></m:ci>
	    <m:apply>
	      <m:ci type="fn" class="discrete">f</m:ci>
	      <m:ci>n</m:ci>
	    </m:apply>
	    <m:apply>
	      <m:ci type="fn" class="discrete">f</m:ci>
	      <m:ci>
		<m:msub>
		  <m:mrow>
		    <m:mo>((</m:mo>
		    <m:mi>n</m:mi>
		    <m:mo>+</m:mo>
		    <m:mi>m</m:mi>
		    <m:mo>))</m:mo>
		  </m:mrow>
		  <m:mi>N</m:mi>
		</m:msub>
	      </m:ci>
	    </m:apply>
	  </m:apply>
        </m:math>
      </para>

      <figure id="fig5">
        <media type="image/png" src="fig5.png"/>
        <caption>
          <m:math>
            <m:apply>
              <m:eq/>
                <m:ci>m</m:ci>
                <m:cn>-3</m:cn>
            </m:apply>
          </m:math></caption>
      </figure>

      <example id="exam1">
        <para id="para6">
          If
          <m:math>
            <m:apply>
              <m:eq/>
                <m:apply>
                  <m:ci type="fn">f</m:ci>
                  <m:ci>n</m:ci>
                </m:apply>
                <m:list>
                  <m:cn>0</m:cn>
                  <m:cn>1</m:cn>
                  <m:cn>2</m:cn>
                  <m:cn>3</m:cn>
                  <m:cn>4</m:cn>
                  <m:cn>5</m:cn>
                  <m:cn>6</m:cn>
                  <m:cn>7</m:cn>
                </m:list>
            </m:apply>
          </m:math>, then
          <m:math>
            <m:apply>
              <m:eq/>
                <m:apply>
                  <m:ci type="fn">f</m:ci>
                  <m:ci>
                    <m:mrow>
                      <m:msub>
                        <m:mrow>
                          <m:mo>((</m:mo>
                          <m:mrow>
                            <m:mi>n</m:mi>
                            <m:mo>-</m:mo>
                            <m:mi>3</m:mi>
                          </m:mrow>
                          <m:mo>))</m:mo>
                        </m:mrow>
                        <m:mi>N</m:mi>
                      </m:msub>
                    </m:mrow>
                  </m:ci>
                </m:apply>
                <m:list>
                  <m:cn>3</m:cn>
                  <m:cn>4</m:cn>
                  <m:cn>5</m:cn>
                  <m:cn>6</m:cn>
                  <m:cn>7</m:cn>
                  <m:cn>0</m:cn>
                  <m:cn>1</m:cn>
                  <m:cn>2</m:cn>
                </m:list>
            </m:apply>
          </m:math>
        </para>

        <para id="para7">
          It's called <term>circular shifting</term>, since we're moving
          around the circle. The usual shifting is called "linear shifting"
          (shifting along a line).
        </para>

      </example>

      <section id="sec1sub1">
        <name>Notes on circular shifting</name>

        <para id="sub1a">
          <m:math display="block">
            <m:apply>
              <m:eq/>
                <m:apply>
                  <m:ci type="fn" class="discrete">f</m:ci>
                  <m:ci>
                    <m:msub>
                      <m:mrow>
                        <m:mo>((</m:mo>
                        <m:mi>n</m:mi>
                        <m:mo>+</m:mo>
                        <m:mi>N</m:mi>
                        <m:mo>))</m:mo>
                      </m:mrow>
                      <m:mi>N</m:mi>
                    </m:msub>
                  </m:ci>
                </m:apply>
                <m:apply>
                  <m:ci type="fn" class="discrete">f</m:ci>
                  <m:ci>n</m:ci>
                </m:apply>
            </m:apply>
          </m:math>
          Spinning <m:math><m:ci>N</m:ci></m:math> spots is the same
          as spinning all the way around, or not spinning at all.
        </para>

        <para id="sub1b">
          <m:math display="block">
            <m:apply>
              <m:eq/>
                <m:apply>
                  <m:ci type="fn" class="discrete">f</m:ci>
                  <m:ci>
                    <m:msub>
                      <m:mrow>
                        <m:mo>((</m:mo>
                        <m:mi>n</m:mi>
                        <m:mo>+</m:mo>
                        <m:mi>N</m:mi>
                        <m:mo>))</m:mo>
                      </m:mrow>
                      <m:mi>N</m:mi>
                    </m:msub>
                  </m:ci>
                </m:apply>
                <m:apply>
                  <m:ci type="fn" class="discrete">f</m:ci>
                  <m:ci>
                    <m:msub>
                      <m:mrow>
                        <m:mo>((</m:mo>
                        <m:mi>n</m:mi>
                        <m:mo>-</m:mo>
                        <m:mrow>
                          <m:mo>(</m:mo>
                          <m:mi>N</m:mi>
                          <m:mo>-</m:mo>
                          <m:mi>m</m:mi>
                          <m:mo>)</m:mo>
                        </m:mrow>
                        <m:mo>))</m:mo>
                      </m:mrow>
                      <m:mi>N</m:mi>
                    </m:msub>
                  </m:ci>
                </m:apply>
            </m:apply>
          </m:math>
          Shifting ACW <m:math><m:ci>m</m:ci></m:math> is equivalent to
          shifting CW 
          <m:math>
            <m:apply>
              <m:minus/>
                <m:ci>N</m:ci>
                <m:ci>m</m:ci>
            </m:apply>
          </m:math>
        </para>

        <figure id="fig6">
          <media type="image/png" src="fig6.png"/>
        </figure>

        <para id="sub1c">
          <m:math display="block">
            <m:apply>
              <m:ci type="fn" class="discrete">f</m:ci>
              <m:ci>
                <m:msub>
                  <m:mrow>
                    <m:mo>((</m:mo>
                    <m:mo>-</m:mo>
                    <m:mi>n</m:mi>
                    <m:mo>))</m:mo>
                  </m:mrow>
                  <m:mi>N</m:mi>
                </m:msub>
              </m:ci>
            </m:apply>
          </m:math>

          The above expression, simply writes the values of
          <m:math>
            <m:apply>
              <m:ci type="fn" class="discrete">f</m:ci>
              <m:ci>n</m:ci>
            </m:apply>
          </m:math> clockwise.
        </para>

        <figure id="fig7" orient="horizontal">
          <subfigure id="subfig7a">
            <media type="image/png" src="fig7a.png"/>
            <caption><m:math><m:apply>
                       <m:ci type="fn" class="discrete">f</m:ci>
                       <m:ci>n</m:ci></m:apply>
                     </m:math>
            </caption>
          </subfigure>
          <subfigure id="subfig7b">
            <media type="image/png" src="fig7b.png"/>
            <caption>
              <m:math>
                <m:apply>
                  <m:ci type="fn" class="discrete">f</m:ci>
                  <m:ci>
                    <m:msub>
                      <m:mrow>
                        <m:mo>((</m:mo>
                        <m:mo>-</m:mo>
                        <m:mi>n</m:mi>
                        <m:mo>))</m:mo>
                      </m:mrow>
                      <m:mi>N</m:mi>
                    </m:msub>
                  </m:ci>
                </m:apply>
              </m:math>
            </caption>
          </subfigure>
        </figure>
      </section>
    </section>

    <section id="sec2">
      <name>Circular shifts and the DFT</name>

      <rule id="rule1" type="theorem">
        <name>Circular Shifts and DFT</name>

        <statement>
          <para id="rulepara1">
            If
            <m:math display="block">
                <m:apply>
                  <m:ci type="fn" class="discrete">f</m:ci>
                  <m:ci>n</m:ci>
                </m:apply>
                <m:mover>
                  <m:mo>↔</m:mo>
                  <m:mtext>DFT</m:mtext>
                </m:mover>
                <m:apply>
                  <m:ci type="fn" class="discrete">F</m:ci>
                  <m:ci>k</m:ci>
                </m:apply>
            </m:math>
            then
            <m:math display="block">
              <m:apply>
                <m:ci type="fn" class="discrete">f</m:ci>
                <m:ci>
                  <m:msub>
                    <m:mrow>
                      <m:mo>((</m:mo>
                      <m:mi>n</m:mi>
                      <m:mo>-</m:mo>
                      <m:mi>m</m:mi>
                      <m:mo>))</m:mo>
                    </m:mrow>
                    <m:mi>N</m:mi>
                  </m:msub>
                </m:ci>
              </m:apply>
              <m:mover>
                <m:mo>↔</m:mo>
                <m:mtext>DFT</m:mtext>
              </m:mover>
              <m:apply>
                <m:times/>
		<m:apply>
		  <m:exp/>
		  <m:apply>
		    <m:minus/>
		    <m:apply>
		      <m:times/>
		      <m:imaginaryi/>
		      <m:apply>
			<m:divide/>
			<m:apply>
			  <m:times/>
			  <m:cn>2</m:cn>
			  <m:pi/>
			</m:apply>
			<m:ci>N</m:ci>
		      </m:apply>
		      <m:ci>k</m:ci>
		      <m:ci>m</m:ci>
		    </m:apply>
		  </m:apply>
                  </m:apply>
                  <m:apply>
                    <m:ci type="fn" class="discrete">F</m:ci>
                    <m:ci>k</m:ci>
                  </m:apply>
              </m:apply>
            </m:math>
            (<foreign>i.e.</foreign> circular shift in time domain =
            phase shift in DFT)
          </para>
        </statement>

        <proof>
          <para id="rulepara2">
            <equation id="eq1">
              <m:math>
                <m:apply>
                  <m:eq/>
                    <m:apply>
                      <m:ci type="fn" class="discrete">f</m:ci>
                      <m:ci>n</m:ci>
                    </m:apply>
                    <m:apply>
                      <m:times/>
                        <m:apply>
                          <m:divide/>
                            <m:cn>1</m:cn>
                            <m:ci>N</m:ci>
                        </m:apply>
                        <m:apply>
                          <m:sum/>
                            <m:bvar><m:ci>k</m:ci></m:bvar>
                            <m:lowlimit>
                              <m:cn>0</m:cn>
                            </m:lowlimit>
                            <m:uplimit>
			<m:apply>
			  <m:minus/>
			  <m:ci>N</m:ci>
			  <m:cn>1</m:cn>
			</m:apply>
		      </m:uplimit>
		      <m:apply>
			<m:times/>
			<m:apply>
			  <m:ci type="fn" class="discrete">F</m:ci>
			  <m:ci>k</m:ci>
			</m:apply>
			<m:apply>
			  <m:exp/>
			  <m:apply>
			    <m:times/>
			    <m:imaginaryi/>
			    <m:apply>
			      <m:divide/>
			      <m:apply>
				<m:times/>
				<m:cn>2</m:cn>
				<m:pi/>
			      </m:apply>
			      <m:ci>N</m:ci>
			    </m:apply>
			    <m:ci>k</m:ci>
			    <m:ci>n</m:ci>
			  </m:apply>
			</m:apply>
		      </m:apply>
		    </m:apply>
		  </m:apply>
                </m:apply>
              </m:math>
            </equation>

            so phase shifting the DFT

            <equation id="eq2">
              <m:math>
		<m:apply>
                  <m:eq/>
		  <m:apply>
		    <m:ci type="fn" class="discrete">f</m:ci>
		    <m:ci>n</m:ci>
		  </m:apply>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:divide/>
		      <m:cn>1</m:cn>
		      <m:ci>N</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:sum/>
		      <m:bvar><m:ci>k</m:ci></m:bvar>
		      <m:lowlimit>
			<m:cn>0</m:cn>
		      </m:lowlimit>
		      <m:uplimit>
			<m:apply>
			  <m:minus/>
			  <m:ci>N</m:ci>
			  <m:cn>1</m:cn>
			</m:apply>
		      </m:uplimit>
		      <m:apply>
			<m:times/>
			<m:apply>
			  <m:ci type="fn" class="discrete">F</m:ci>
			  <m:ci>k</m:ci>
			</m:apply>
			<m:apply>
			  <m:exp/>
			  <m:apply>
			    <m:minus/>
			    <m:apply>
			      <m:times/>
			      <m:imaginaryi/>
			      <m:apply>
				<m:divide/>
				<m:apply>
				  <m:times/>
				  <m:cn>2</m:cn>
				  <m:pi/>
				</m:apply>
				<m:ci>N</m:ci>
			      </m:apply>
			      <m:ci>k</m:ci>
			      <m:ci>n</m:ci>
			    </m:apply>
			  </m:apply>
			</m:apply>
			<m:apply>
			  <m:exp/>
			  <m:apply>
			    <m:times/>
			    <m:imaginaryi/>
			    <m:apply>
			      <m:divide/>
			      <m:apply>
				<m:times/>
				<m:cn>2</m:cn>
				<m:pi/>
			      </m:apply>
			      <m:ci>N</m:ci>
			    </m:apply>
			    <m:ci>k</m:ci>
			    <m:ci>n</m:ci>
			  </m:apply>
			</m:apply>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		  <m:apply>
		    <m:times/>
		    <m:apply>
		      <m:divide/>
		      <m:cn>1</m:cn>
		      <m:ci>N</m:ci>
		    </m:apply>
		    <m:apply>
		      <m:sum/>
		      <m:bvar><m:ci>k</m:ci></m:bvar>
		      <m:lowlimit>
			<m:cn>0</m:cn>
		      </m:lowlimit>
		      <m:uplimit>
			<m:apply>
			  <m:minus/>
			  <m:ci>N</m:ci>
			  <m:cn>1</m:cn>
			</m:apply>
		      </m:uplimit>
		      <m:apply>
			<m:times/>
			<m:apply>
			  <m:ci type="fn" class="discrete">F</m:ci>
			  <m:ci>k</m:ci>
			</m:apply>
			<m:apply>
			  <m:exp/>
			  <m:apply>
			    <m:times/>
			    <m:imaginaryi/>
			    <m:apply>
			      <m:divide/>
			      <m:apply>
				<m:times/>
				<m:cn>2</m:cn>
				<m:pi/>
			      </m:apply>
			      <m:ci>N</m:ci>
			    </m:apply>
			    <m:ci>k</m:ci>
			    <m:apply>
			      <m:minus/>
			      <m:ci>n</m:ci>
			      <m:ci>m</m:ci>
			    </m:apply>
			  </m:apply>
			</m:apply>
		      </m:apply>
		    </m:apply>
		  </m:apply>
		  <m:apply>
		    <m:ci type="fn" class="discrete">f</m:ci>
		    <m:ci>
		      <m:msub>
			<m:mrow>
			  <m:mo>((</m:mo>
			  <m:mi>n</m:mi>
			  <m:mo>-</m:mo>
			  <m:mi>m</m:mi>
			  <m:mo>))</m:mo>
			</m:mrow>
			<m:mi>N</m:mi>
		      </m:msub>
		    </m:ci>
		  </m:apply>
                </m:apply>
              </m:math>
            </equation>
          </para>
        </proof>
      </rule>

    </section>

  </content>
</document>
