First let’s refresh the natural minor scale formula. Where “^” denotes a half-step, the formula is:
1 2^b3 4 5^b6 b7 1.
However, there are two very common variations of the minor scale: harmonic and melodic. The simple explanation is that they lead better to the root note (the “1” of a scale). Here’s what harmonic minor sounds like:
And here’s the harmonic minor scale formula: 1 2^b3 4 5^b6 7^1.
Notice that there are three half-steps in this scale, rather than two. They occur between 2 and b3, 5 and b6, and 7 and 1. Also note that because the 7th is not flatted, the distance between b6 and 7 is not a whole-step, like it is in natural minor, but a whole-step and a half (three semitones).
Melodic minor is slightly more complicated. Melodic minor factors in the unusual gap (the three semitones) between the b6 and 7 and raises the 6th by a half-step. But here’s the catch: the 6th and 7th notes are raised in melodic minor only when it’s played ascending. If you’re going down a melodic minor scale, it’s played the same way as a natural minor scale.
Melodic minor ascending: 1 2^b3 4 5 6 7^1
Melodic minor descending: 1 2^b3 4 5^b6 b7 1
Here’s what the melodic minor scale sounds like, first ascending, then descending:
Don’t confuse this with harmonic minor, though. Harmonic minor is played the same regardless of whether it’s ascending or descending.
TL;DR: harmonic and melodic minor are two variations on the natural minor scale. The harmonic minor formula is: 1 2^b3 4 5^b6 7^1. The melodic minor formula depends on whether you are going up or down the scale. If you’re going up, it’s 1 2^b3 4 5 6 7^1; If you’re going down it’s the same as natural minor, 1 2^b3 4 5^b6 b7 1.