The metric for a Reissner-Nordstr\(\ddot{o}\)m black hole in the background of the Friedman-Robertson-Walker universe is obtained. Then we verified it and discussed the influence of the evolution of the universe on the size of the black hole. To study the problem of the orbits of a planet in the expanding universe, we rewrote the metric in the Schwarzschild coordinates system and deduced the equation of motion for a planet.