Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to inductively prove that for any string s, the reverse of the reverse of string s is string s.

share|cite|improve this question
I am sorry to hear that, because that sounds like a heavy-handed approach to something which is really obvious: the reverse of $a_1 \cdots a_n$ is $a_n \cdots a_1$ and the reverse of that is of course $a_1 \cdots a_n$. Note though that you have not asked a question. – Pete L. Clark Mar 23 '11 at 5:38
It could be to help familiarize the OP with induction. – Alex Becker Mar 23 '11 at 6:01
What is your inductive definition of "string reversal" ? – mercio Mar 23 '11 at 12:46

The case $n = 1$ is trivial. For $n > 1$, assume that the statement holds for all $i < n$. Let $s = as'$ be a string of length $n$ where $a$ has length 1 and $s'$ has length $n - 1$. The key is to observe that rev($ab$) = rev($b$)rev($a$). Therefore rev(rev($s$)) = rev(rev($as'$)) = rev(rev($s'$)rev($a$)) = rev(rev($a$))rev(rev($s'$)) = $as'$ = $s$, thus the statement holds for strings of length $n$. We have now proved by induction that the reverse of the reverse of a string $s$ is $s$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.