Answer
the two numbers are $20$ and $20$
Work Step by Step
Let $x$ be the first number. Since the sum of the two numbers is $40,$ then the second number is $40-x$.
The product of the two numbers, $y,$ is
\begin{align*}
y&=x(40-x)
.\end{align*}
In the form $y=a(x-h)^2+k,$ the equation above is equivalent to
\begin{align*}
y&=40x-x^2
\\
y&=-x^2+40x
\\
y&=-(x^2-40x)
\\\\
y&=-\left(x^2-40x+\left(\dfrac{-40}{2}\right)^2\right)-(-1)\left(\dfrac{-40}{2}\right)^2
\\\\
y&=-\left(x^2-40x+400\right)+400
\\\\
y&=-\left(x-20\right)^2+400
.\end{align*}
Since the vertex of $y=a(x-h)^2+k$ is given by $(h,k)$, then the vertex of the equation above is $(20,400)$.
The maximum value occurs at the vertex $(h,k)$ where the maximum is $k$ when $x=h$. Thus the maximum product, $y,$ is $400$ which occurs when $x=20.$
Hence, the first number, $x,$ is $20$ and the second number ,$40-x$, is $20$.