I want to lose weight. I commute to my office daily by walking 3 kilometers. If I buy a bicycle and use it for commuting (total 3 km daily), would it be better than walking?
This research claims around walking 334 kilojoules of energy expended for a 1.6km walk
Using the same 1.6km distance, if you cycled at 20km/h at 70watts (arbitrary but vaguely-plausible numbers), you would be involve around 20 kilojoules being "sent to the pedals". Assuming you are about 20% efficient, that would be 100kilojoules burned
For that distance, at a relatively leisurely pace, walking uses more energy.
However, there is more to it than that:
Cycling is a more efficient means of transport. Both methods may use similar amounts of energy, but cycling will be faster. This means you could cycle a longer route to work, "burn more calories", and still get to work at the same time.
Then again, cycling has it's drawbacks - it requires more supporting equipment (a bike being the main part, also things like a helmet, puncture repair kit, maybe lights, and of course somewhere to securely park the bike)
..but really, the most important factor is doing something. Maybe choosing cycling would mean you would spend months saving up the money before you even start? Or maybe you'll enjoy cycling, and start going on longer rides, for fun?
Finally, remember the natural reaction to more exercise is simply "eat more". It is hard and requires conscious effort to go against this (to increase exercise without eating more)
The rational side of me says that over the short distance you're talking about, walking would cost more energy than cycling. The caveat here of course is how fast you walk.
However when I first got back on my bike (and I was pretty overweight), I started off cycling between the train station and my office. It was something like 2 miles each way, and used to take maybe 10 or 15 minutes.
I did this twice a day, five days a week, and really started shedding the pounds. I found this incredible, with such a small amount of time spent in the saddle. And at the same time, I was eating the same things I always had.
The only thing I can think of was that my heart rate got sufficiently high when I cycled (never that high when I walked) that it kick-started my metabolism and burned fat.
How likely this theory is I have no idea, but there was no mistake what I saw on the scales.
It depends on how vigorously you walk or bike. Like, this article looking at long-term weight change said people did better with "increases in moderately intense exercise, including biking, brisk walking, jogging, swimming and hiking — but not to slow walking (less than 3 miles per hour)." So, if you walk slowly, biking or walking quickly would be better.
Like @Daniel R Hicks suggested, you could also think about adding some distance to your commute.
In considering the efficiency of exercise with regard to weight loss, the variable which should be optimized is time. If we put in some hours walking versus cycling, which is better use of our time?
The answer is: whichever you put your gut-busting effort into!
Leisurely cycling on a flat course for an hour will use less energy than a one hour race-walk.
Conversely, all-out cycling for an hour to go as far as possible in that time will beat a leisurely one hour stroll.
Either activity will make you fit and lean if you treat it as a sport, and train progressively to bring down your times.
It is also with noting that there will be diminished returnson both . As your body gets used to one exercise it will become more efficient at performing it. So eventually one activity will be better than another. You might consider cross training and doing both on different days so your body does not get used to one.