I've been learning a new song and it has a part where I need to play two notes an octave away. I can just about reach it if I use my thumb and middle finger, but it's close and my middle finger keeps slipping down onto a lower note. Are there stretches or tips for how to play this? Edit: I didn't make this clear before, but the notes have to be played together.
So, assuming those are the only two notes you have to play with that hand, I think almost any pianist would choose to play with thumb and pinky. Not that it means you have to play it that way, but as you keep practicing you'll notice that certain intervals (the octave you mentioned is an example of an interval) start to feel natural to play with certain fingers. Getting used to way that your hand feels when you play C and C (up an octave), or F and C is part of what makes you a better player. So I would encourage you to practice playing with your thumb and pinky until you get used to it.
You can practice it by playing those two notes by themselves with your thumb and pinky, then take your hand off of the piano and try to put it back down in the exact same place. Once you can do that pretty easily, then start playing the notes in the song that come before the octave part.
Also, just curious, you say your fingers "slips". Do you mean that you start by playing both notes correctly but then your finger slips over to a different note? Or do you mean that as you set your hand down your pinky touches the C key but doesn't get a chance to push it down before it slips to a different note?
Why not 1 and 5?
But, generally, if you get stuck with an impossible stretch, DON'T stretch. Just move the hand.
Try this. Put your hand on your left knee. Move it to your right knee. Then back again. Very easy to do almost instantaneously, right?
Now put your thumb on middle C. Hand relaxed and not stretched. Move your hand up an octave, play the next C up with your thumb.
Sometimes you connect. Sometimes you just move.