No doubt someone will be along shortly to give you the science bit, but until then my suggestion is to go with what feels comfortable. The recommendation usually is that you "spin" the pedals: try to maintain a pedalling speed of around 90 pedal revolutions per minute. Well, actually I think between 80-100 is OK.
Apparently, most inexperienced riders tend to pedal too slowly, pushing too high a gear, which is not good for your knees. I was in that category until ..
I noticed that days when I "took it easy" going to work (basically, using a slightly lower gear) were faster than days when I tried to go fast, using a higher gear. A bit of googling later and I realised what was going on.
I measured my "cadence" (which is what the pedalling rpm is known as) on an easy day as about 90-95rpm by using the stopwatch on my cycle computer, counting how many times I turned the pedal in say 10 or 15 seconds and multiplying up appropriately. So I was happy with that 'cos it felt comfortable and worked best for me. And as a bonus was in the "recommended range".
So I stick with that .. course, as my legs have got stronger I can now hold that cadence in a higher gear and so get to work quicker.
One thing to avoid is using low gear at the front, high at the back, and vice versa 'cos it crosses your chain up and makes it unhappy.