Why are large planets away from the Sun and smaller planets near the Sun? In school, we are taught that every planet attracts every other.
$$F=G\frac{mM}{R^2}$$
Stars have a large gravitational force and it attracts every large object.
Every planet has a different mass and travels in an elliptical orbit.
They have a specific orbit because of rotation of a planet which provides angular momentum and keeps it away from the sun at a specific distance and prevents it from going into the sun.
Why are large planets away from the Sun and smaller planets near the Sun?
As attraction between large planet is large so larger planet should be closer to the sun but it is reverse of that.
I don't understand till now, why it is like this.
 A: We know there are stellar systems with large jovian planets near the star. The first extrasolar planet found around a star is 51-Peg, which is such a Jupiter sized planet very close to the star. There are a fair number of these "torch jovian" planets. As a result the solar system is just one particular configuration of planets.
There was an old model that assumed a protoplanetary disk that was thin near the star, thick further out and thinning further out. This was meant to explain the distribution of planetary masses in the solar system. Then with radiation from the star the volatile gasses are pushed further out leaving silicon to iron material behind that forms rocky planets. There is some reason to think stellar radiation can push gasses out if they are not locked into large jovian planets. However, the model of the protoplanetary disk is regarded now as not universal. 
I read a while back a hypothesis on how the solar system has such small planets close to the sun.  The idea is that early on there were two Neptune-sized planets that either collided or by mutual gravitation caused one to be slung out of the system and one fell into the sun. This left rocky material left close to the sun to form Mercury, Venus, Earth and Mars, also with maybe Ceres and asteroids. The early solar system was probably chaotic and violent, as the moon is now thought to be the result of a Mars sized planet that collided with the proto-earth.
