1. Let n denotes the number you choose (in your example n = 9)

2. Then the 1st factor of the product is x and the 2nd consequently (n - x)

3. The product p can be written as

4. This is a quadratic function opening down whose maximum is at it's vertex which is

5. So the maximum value is (with your example )