Is the reason we don't have any perpetual motion machines because of the first law of thermodynamics? Would it be possible to create one if (for example) there was a wheel, and it had a push– if it was frictionless, and in a vacuum, would it spin forever? Also, would gravity matter if friction wasn't in the equation?
Is the reason we don't have any perpetual motion machines because of the first law of thermodynamics?
That's one of the reasons, and it applies to a perpetual motion machine of the first kind, a machine that can produce work without any energy input in violation of the first law (conservation of energy).
There is also a perpetual motion machine of the second type, which is a machine that can operate in a cycle exchanging heat with only one temperature reservoir completely converting 100% of the heat into work. This machine violates the second law of thermodynamics.
Would it be possible to create one if (for example) there was a wheel, and it had a push– if it was frictionless, and in a vacuum, would it spin forever?
What you are describing is sometimes call a perpetual motion machine of the third kind. It is based on the idea that motion, once started, can continue forever. This requires the complete elimination of any and all forms of friction, which is not possible, even when operating in a vacuum (which in practice is never perfect). Even space is not completely free of particles.
Also, would gravity matter if friction wasn't in the equation?
Not quite sure what you mean by "would gravity matter". As the range of gravity is essentially infinite, it is impossible to completely isolate the machine from gravity and gravitational forces (Newtonian gravity).
Hope this helps.
A wheel frictionlessly rotating in a vacuum, although it would do so indefinitely, isn't a perpetual motion machine. It doesn't perform any work: e.g. you can't make a light bulb give off light using the energy of this wheel for unlimited amount of time. As soon as you try, you'll slow the rotation down, and the motion will cease being perpetual.
"Friction" is the simplest one-word answer, though you seem eager to simply discard it from your math without addressing how this would ever be done in reality. Pretending that there isn't a flawgic gap there, another broader version of the same one-word answer is "entropy."
That being said, these issues are all elements of the material space side of the whole spacetime situation. I began to wonder if it might be possible to find a theoretical opportunity for a machine to be run for a timespan that is approaching/functionally equivalent to infinite... not by perfecting the machine, but by situating it in circumstances different enough that "the machine's perception of time" and/or our perception of its relationship to time could be manipulated or distorted to meet the letter of the request, if a bit disingenuously.
What if a cheaply hacked together RunsALongTime9000 device was activated in the neighbourhood of a black hole or other gravitational anomaly? The seemingly obliterative punchline of a black hole complicates this, as does our difficulty in mapping out the play-by-play experience of being rended in one of these freaky space-blenders. But orbiting satellites and International Space Station long-stays both involve significant enough deviance from our standard Earth's Crust Gravity that computed times have to be corrected after being determined properly, and empirical human experience can began to perceive the different rate of the passage of time in orbit vs on Earth. It may not take anything near the gravitational scale of a black hole to allow Earth-lubbers observing from home to witness a machine operating at basically the same level of functionality for longer than any human lifespan, and so in pragmatic terms, "forever".
Another question for the question worth exploring: Does a machine have to have moving parts (or the electronic equivalent) in order to be deemed a machine or in order to be deemed in operation? I have heard Stonehenge described (in line with certain theories of its purpose and function) as an astronomical computer. But friction is only a very, very long-timeframe factor there. Although a factor it remains, and again the problem of erosion and collapse can be more wholely identified as the tendency towards entropy as time progresses.