Battery Monitoring using voltage divider on ADC pin with STM32F030
1) as mention in datasheet external input impedance(Rain) is 50k, how
  can i achieve matching impedance using voltage divider with minimum
  current drain.


You don't need to 'match' an impedance. The 50k is the maximum input impedance at which the ADC's characteristics are guaranteed by the manufacturer.

Generally, you will want to have your voltage divider use as high resistance as possible to reduce current drain. Hence, you'd lay out the divider to have about 50kOhm of output impedance.


  2) how to calculate ADC Clock frequency for this STM32F030.


Depends on how fast you want/need to sample and at what accuracy.


  3) how capacitor help in matching impedance.


The ADC's input pin is not constantly sinking current. It only draws current from the signal source for a short moment each time a measurement is taken (sample&amp;hold).

Adding a capacitor to the ADC's input reduces the (AC!) impedance of the input signal as seen by the ADC during the brief moment it actually sinks current. This way, your signal's impedance can be much higher because it is not the instantaneous signal voltage that's measured (/loaded) but the voltage of the capacitor; after one measurement, the capacitor can be slowly (via the higher impedance voltage divider) charged back to the actual signal voltage to be ready for the next sampling.

Look up the capacitance of the S&amp;H buffer in the ADC. Should be somewhere in the datasheet, in the order of a couple of pico Farad. Then select a capacitor of e.g. 100x-1000x that capacity and you should get pretty good measurements. (The bigger the external capacitor the less voltage drop at the moment of sampling, but a bigger capacitor takes longer to charge to close to the signal voltage so you can effectively trade accuracy for sampling speed.)


  4) what value of resistor in divider should i have to select for matching impedance.


Fully depends on the battery's voltage and the max. ADC input voltage.