In this paper , we consider dynamical behavior of astrophysical objects such as galaxies and dwarf galaxies taking into account both the gravitational attraction between them and the cosmological expansion of the Universe . First , we obtain the general system of equations and apply them to some abstract systems of galaxies . Then we investigate the collision between the Milky Way and Andromeda in future . Here , we distinguish two models . For the first one , we do not take into account the influence of the Intra-Group Matter ( IGrM ) . In this case , we demonstrate that for currently known parameters of this system the collision is hardly plausible because of the angular momentum . These galaxies will approach the minimum distance of about 290 Kpc in 4.44 Gyr from present , and then begin to run away irreversibly from each other . For the second model , we take into account the dynamical friction due to the IGrM . Here , we find a characteristic value of the IGrM particle velocity dispersion \tilde { \sigma } = 2.306 . For \tilde { \sigma } \leq 2.306 , the merger will take place , but for the bigger values of \tilde { \sigma } the merger can be problematic . If the temperature of the IGrM particles is 10 ^ { 5 } K , then this characteristic value of \tilde { \sigma } corresponds to the IGrM particle mass 17 MeV . Therefore , for the IGrM particles with masses less than 17 MeV the merger becomes problematic . We also define the region in the vicinity of our Local Group where the formation of the Hubble flows starts . For such processes , the zero-acceleration surface ( where the gravitational attraction is balanced by the cosmological accelerated expansion ) plays the crucial role . We show that such surface is absent for the Local Group . Instead , we find two points and one circle with zero acceleration . Nevertheless , there is a nearly closed area around the MW and M31 where the absolute value of the acceleration is approximately equal to zero . The Hubble flows are formed outside of this area .