Gather the ingredients. Heat the oven to 375℉/190℃.
Over medium heat, melt 1 ounce (2 tablespoons) of the butter in a large frying pan and gently cook the sliced onions until soft but not browned. Set aside.
In an ovenproof frying pan or stovetop casserole, melt 1½ ounces (3 tablespoons) of the butter.
Remove the pan from the heat and then arrange a layer of potatoes in the pan.
Add a layer of onions.
Sprinkle on a layer of cheese.
Season with salt and pepper and repeat the layers ending with potatoes on top.
Place the pan over medium heat on the stovetop and cook for a few minutes, or until the bottom layer of potatoes is brown.
Dot the surface of the potatoes with the remaining butter, then place in the heated oven and bake for 30 minutes. Remove from the oven.
Raise the oven temperature to 425℉/220℃ and, when the oven has gotten up to temperature, return the pan to the oven and cook for 15 minutes.
To serve, loosen the edges of the potato cake from the frying pan with a spatula.
Flip the pan over quickly onto a plate or cutting board.
Cut into generous wedges and enjoy.