Answer
$${\text{ }}x = 2{\text{ and }}y = 6$$
Work Step by Step
$$\eqalign{
& {\text{Let }}x{\text{ and }}y{\text{ the numbers}}{\text{, }} \cr
& {\text{The numbers satisfies the equation}} \cr
& 3x + y = 12{\text{ }}\left( {\bf{1}} \right) \cr
& {\text{In this case}},{\text{ the objective function is the product }}x{\text{ and }}y \cr
& P = xy{\text{ }}\left( {\bf{2}} \right) \cr
& {\text{Solve the equation }}\left( {\bf{1}} \right){\text{ for }}y \cr
& y = 12 - 3x \cr
& {\text{Substitute }}12 - 3x{\text{ for }}y{\text{ into the equation }}\left( {\bf{2}} \right) \cr
& P = x\left( {12 - 3x} \right) \cr
& P = 12x - 3{x^2},{\text{ with domain }}0 \leqslant x \leqslant 4{\text{ for }}P \geqslant 0 \cr
& {\text{Differentiate }}P{\text{ with respect to }}x \cr
& \frac{{dP}}{{dx}} = 12 - 6x \cr
& {\text{Find the critical points by solving }}\frac{{dP}}{{dx}} = 0 \cr
& 12 - 6x = 0 \cr
& x = 2 \cr
& {\text{Now we can calculate }}y \cr
& y = 12 - 3x \cr
& y = 12 - 3\left( 2 \right) \cr
& y = 6 \cr
& \cr
& {\text{To find the absolute maximum value of }}P{\text{ on the domain}} \cr
& {\text{We check the endpoints }}0 \leqslant x \leqslant 4{\text{ and the point }}x = 2 \cr
& P\left( 0 \right) = \left( 0 \right)\left( {12 - 3\left( 0 \right)} \right) = 0 \cr
& P\left( 2 \right) = \left( 2 \right)\left( {12 - 3\left( 2 \right)} \right) = 12 \cr
& P\left( 4 \right) = \left( 4 \right)\left( {12 - 3\left( 4 \right)} \right) = 0 \cr
& {\text{Because }}P\left( 0 \right) = P\left( 4 \right) = 0{\text{ and }}P\left( 2 \right) = 12,{\text{ }} \cr
& {\text{The absolute maximum value of }}P{\text{ occurs at }}x = 2 \cr
& \cr
& {\text{Therefore}}{\text{, the numbers are }}x = 2{\text{ and }}y = 6 \cr} $$