The fastest PWM frequency you can get with the digital output PWM pins is 980 hz (D5 & D6 only)
If you need 50 khz you need to use Timer1.
http://playground.arduino.cc/Code/Timer1
The Timer1 statement takes a PERIOD (uS), (not a FREQUENCY) so the period for 50khz is 20uS.(in the INITIALIZATION statement)
The dutycycle is in the Timer1pwm statement and it is an integer between 0 and 1024 (NOT a %)
See example below:
pinMode(10, OUTPUT);
Timer1.initialize(500000); // initialize timer1, and set a 1/2 second period
Timer1.pwm(9, 512); // setup pwm on pin 9, 50% duty cycle