The Right Question to Ask
to Free the Lady in the Cage

   
    First of all, it makes no difference which of the guards you give this question to.  Simply ask, "What button would the other guard tell me to push in order to open the cage and set the lady free?"

    Then, no matter what answer you receive, you will know that it would be the other button you need to push -- rather than the one you were told.  For the liar would tell the opposite of what the truthful guard would say, and the truthful guard would honestly tell you what the liar would say.