Will Earth lose the Moon before the Sun goes into supernova? Ive read on some sites and saw on youtube videos that the moon is getting away from earth by 1-3 cm a year. 

Is this enough to make the Earth lose the Moon before the Sun goes into Supernova?

Im asking because I would like to do the calculations for Earths magnetic pull on this subject. It appears to me that it should be a non-linear function (there are also other factors, like if the Moon could be captured by another planet or having asteroids messing with its orbit on Earth).

Thank you.
As HDE 226868 noted in his answer, the Sun is not going to go supernova. That's something only large stars experience at the end of their main sequence life. Our Sun is a dwarf star. It's not big enough to do that. It will instead expand to be a red giant when it burns out the hydrogen at the very core of the Sun. It will continue burning hydrogen as a red giant, but in a shell around a sphere of waste helium. The Sun will start burning helium when it reaches the tip of the red giant phase. At that point it will shrink a bit; a slight reprieve. It will expand to a red giant once again on the asymptotic red giant branch when it burns all the helium at the very core. It will then burn helium in a shell surrounding a sphere of waste carbon and oxygen. Larger stars proceed beyond helium burning. Our Sun is too small. Helium burning is where things stop.

The Sun has two chances as a red giant to consume the Earth. Some scientists say the Sun will consume the Earth, others that it won't. It's all a bit academic because the Earth will be dead long, long before the Sun turns into a red giant. I'll have more to say on this in the third part of my answer.



The current lunar recession rate is 3.82 cm/year, which is outside your one to three centimeters per year window. This rate is anomalously high. In fact, it is extremely high considering that dynamics says that
$$\frac {da}{dt} = (\text{some boring constant})\frac k Q \frac 1 {a^{11/2}}$$
Here, $a$ is the semi major axis length of the Moon's orbit, $k$ is the Earth-Moon tidal Love number, and $Q$ is the tidal dissipation quality factor. Qualitatively, a higher Love number means higher tides, and a higher quality factor means less tidal friction.

That inverse $a^{5.5}$ factor indicates something seriously funky must be happening to make the tidal recession rate so very high right now, and this is exactly the case. There are two huge north-south barriers to the flow of the tides right now, the Americas in the western hemisphere and Afro-Eurasia in the eastern hemisphere. This alone increases $k/Q$ by a considerable amount. The oceans are also nicely shaped so as to cause some nice resonances that increase $k/Q$ even further.

If something even funkier happens and the Moon recedes at any average rate of four centimeters per year over the next billion years, the Moon will be at a distance of 425,000 km from the Earth (center to center). That's less than 1/3 of the Earth's Hill sphere. Nearly circular prograde orbits at 1/3 or less of the Hill sphere radius should be stable. Even with that over-the-top recession rate, the Moon will not escape in the next billion years.



What about after a billion years? I chose a billion years because that's about when the Moon's recession should more or less come to a standstill. If the Earth hasn't already died before this billion year mark, this is when the Earth dies.

Dwarf stars such as our Sun get progressively more luminous throughout their life on the main sequence. The Sun will be about 10% more luminous than it is now a billion years into the future. That should be enough to trigger a moist greenhouse, which in turn will trigger a runaway greenhouse. The Earth will become Venus II. All of the Earth's oceans will evaporate. Water vapor will reach well up into what is now the stratosphere. Ultraviolet radiation will photodissociate that water vapor into hydrogen and oxygen. The hydrogen will escape. Eventually the Earth will not only be bare of liquid water on the surface, it will be bare of water vapor in the atmosphere.

Almost all of the Moon's recession is a consequence of ocean tides. Without oceans, that tunar recession will more or less come to a standstill.