If you learn to "hear" an interval in your mind, and know what it is, then it is easy to reproduce that interval on the keyboard -- and that, of course, is what "playing by ear" is all about -- mental hearing and then reproducing what you hear on the keyboard. (This course is also excellent for singers and instrumentalists!)