Write the general cubic function:

#f(x) = ax^3+bx^2+cx+d#

Its first and second derivative are:

#f'(x) =3ax^2+2bx +c#

#f''(x) = 6ax +2b#

If #f(x)# has an inflection point in #(3,2)# this means that:

#f''(3) = 0 => color(blue)(18a + 2b = 0)#

and

#f(3) = 2 => color(blue)(27a +9b +3c + d = 2)#

Then we know that the point #(5,10)# is a maximum, so:

#f'(5) = 0 => color(blue)(75a+10b+c =0)#

#f(5) = 10 => color(blue)(125a+25b+5c+d= 10)#

We have now four linear equations in four unknowns: the solution of the system gives us the values of the coefficients of the cubic:

#{(18a + 2b = 0),(27a +9b +3c + d = 2),(75a+10b+c =0),(125a+25b+5c+d= 10):}#

Subtract the second equation from the fourth:

#{(18a + 2b = 0),(98a +16b +2c =8),(75a+10b+c =0),(125a+25b+5c+d= 10):}#

Multiply the third equation by #2#:

#{(18a + 2b = 0),(98a +16b +2c =8),(150a+20b+2c =0),(125a+25b+5c+d= 10):}#

Subtract the second from the third:

#{(18a + 2b = 0),(52a +4b =- 8),(150a+20b+2c =0),(125a+25b+5c+d= 10):}#

Multiply the first equation by #2#:

#{(36a + 4b = 0),(52a +4b =- 8),(150a+20b+2c =0),(125a+25b+5c+d= 10):}#

Subtract the first from the second:

#{(16a = -8),(52a +4b =- 8),(150a+20b+2c =0),(125a+25b+5c+d= 10):}#

and we have:

#{(a = -1/2),(b=9/2),(c=-15/2),(d=-5/2):}#

So the function is:

#f(x) = -1/2x^3+9/2x^2-15/2x-5/2#

graph{-1/2x^3+9/2x^2-15/2x-5/2 [-29.24, 34.84, -14.1, 17.94]}