In order to find the fraction of the pie Ralph eat after dinner, you take into account that after dinner He ate 1/3 of the pie he leaft before dinner.
You can write that the pie before dinner is variable x, then, before dinner Ralph ate 1/2 of such a pie, that is, Ralph ate 1/2x, hence, He leaft x - 1/2x=1/2x before dinner.
He ate 1/3 of the Pie he leaft before dinner, that is He ate 1/3(1/2x) = 1/6x
Hence, Ralph ate 1/6 of the pie after dinner.