I had an idea a while back for a machine that would be totally green. Powered by a Hydrogen Fuel Cell. A big question came up: Where do I get the Hydrogen? I assumed that I could just electrolysis of water to create Oxygen (which would be released into the air) and Hydrogen (which would be used in the cell). But, then I remembered a key factor of bonds: Creating a bond gives the nuclei a more stable configuration, which releases energy. Breaking a bond requires an input of energy.
Let's say I use electrolysis to split water. This will take energy. Then I use a Hydrogen Fuel Cell to generate electricity. This process gives me the same amount of water that I just split.
Q: Which process uses/gives more energy? Would the above example result in a net gain or loss?