This is really a basic law of the universe: you can’t get out more energy than you put in. (Accounting for the fact mass and energy are convertible.)
Starting from this basic principle you can start to look at the problems with specific perpetual motion machines, which are all basically the same – either you’re taking more energy out of the system than you put in, or you’re losing some energy due to inefficiency (almost always heat). Both either lead to the system slowing down or you having to put more energy in than you take out.
Latest Answers