You asked:

was frederick william iv of prussia younger than elisabeth ludovika of bavaria

No. Frederick William IV of Prussia is not younger than Elisabeth Ludovika of Bavaria.
Frederick William IV of Prussia
Frederick William IV of Prussia
Frederick William IV of Prussia

Elisabeth Ludovika of Bavaria