Sample two numbers from 1 to 10; maximize the expected product Assume you sample two numbers, randomly drawn from 1 to 10; you could choose two strategies: 1) pick with replacement and 2) pick without replacement. Which strategy would you prefer to maximize the expected product?
I encountered this problem while preparing for an interview. My intuition is picking with replacement would be better. However, I found it too complex to use the brute-force method to prove it. Could anyone suggest a better approach?

If you're better at programming than maths, I believe there's a reasonably simple way to get this by brute force as well.
It provides a slightly different intuition: $E[XY]$ is higher without replacement when $X < \text{mean}(X)$, because removing a low value of $X$ increases $E[Y]$, it is lower, and by a greater amount, when $X > \text{mean}(X)$. A little thought shows that this asymmetry occurs because we're looking at the product, e.g. it wouldn't happen for $E[X + Y]$.
library(tidyverse)
vals = 1:10

# Calculate E[XY|x] conditional on each possible value of X
no_replace = map_dbl(vals, function(x) mean(x * vals[vals != x])) 
with_replace = map_dbl(vals, function(x) mean(x * vals))

# Take averages over X values to get E[XY]
mean(no_replace) # 29.33333
mean(with_replace) # 30.25

# Plot
df = data.frame(x = vals, 
                `Replacement`=with_replace, 
                `Without replacement`=no_replace)
df %>% pivot_longer(-x) %>% 
  ggplot(aes(x, value, color = name)) + 
  geom_point() +
  geom_path() +
  geom_vline(linetype = 'dashed', xintercept = mean(vals)) +
  scale_x_continuous(breaks = vals) +
  labs(x = 'X', y = 'E[XY]', color = 'Method')


