I plan on using a 12v battery to power the raspberry pi for mobile usage, but I need to drop it down to 5v. As a normal voltage regulator using the lm317t would waste a lot of energy, I was thinking of using a pulse width modulator with a duty cycle of 41.6% which should make a 5v out, then a inductor and a capacitor to remove noise.
Would this work or am I talking rubbish?
Not very well, what exactly will happen depends on the output of your PWM device.
If the PWM switches between 12 and floating then under small loads you will end up with damn near 12V on the output.
If the PWM switches between 12 and 0 then it will provide somewhere around 5V but there will be current flows in both directions through the inductor as the switch changes. Further if you are not careful the inductor may damage the PWM source.
What you want is called a "buck converter" It's similar in principle changing the output voltage by changing the behaviour of a switch but it's engineered so current only flows one way through the inductor and it controls the output voltage through feedback. If you don't want to construct such a converter yourself you can get modules to do it for you. E.G. http://uk.farnell.com/xp-power.....dp/1861095