We study confined Brownian motion by investigating the memory function of a $$d$$ -dimensional hypercube ( $$d\ge 2$$ ), which is subject to a harmonic potential and suspended in an ideal gas confined by two parallel walls. For elastic walls and under the infinite-mass limit, we obtain analytic expressions for the force autocorrelation function and the memory function. The transverse-direction memory function possesses a nonnegative tail decaying like $$t^{-(d-1)}$$ , from which anomalous diffusion is expected for $$d=2$$ . For $$d=3$$ , the position-dependent friction coefficient becomes larger than the unconfined case and the increment is inversely proportional to the square of the distance from the wall. We also perform molecular dynamics simulations with thermal walls and/or a finite-mass hypercube. We observe faster decay due to the thermal wall ( $$t^{-3}$$ for $$d=2$$ and $$t^{-5}$$ for $$d=3$$ under the fully thermalizing wall) and convergence behaviors of the finite-mass memory function, which are different from the unconfined case.