Phalanx formation

The phalanx formation is an Ancient Greek term for a block-like infantry formation. The Greek hoplites (heavy infantry) were armed with spears, swords, or similar weapons. The mass of infantry marched forward as one entity against opponents. The system was used by city states, who often fought each other. Cavalry were rare, partly because horses were a scarce resource, and partly because the lack of space on valley floors in the Peloponnese left little room for cavalry manoeuvres. Later, the Macedonian phalanx was always supported by cavalry in the conquests of Alexander the Great.
Tactics.
Early battles with the phalanx usually resulted in similar formations pushing against each other until one broke. The potential of the phalanx to do more was shown at the Battle of Marathon (490 BC). Facing the huge army of Darius I, the Athenians thinned out their phalanx and lengthened their front to avoid being outflanked. However, even a reduced-depth phalanx proved unstoppable to the lightly armed Persian infantry. After routing the Persian wings, the hoplites on the Athenian wings wheeled inwards, destroying the elite troop at the Persian centre. This was a crushing victory for Athens. Throughout the Greco-Persian Wars the hoplite phalanx continued to defeat the Persian infantry (e.g. the battles of Thermopylae and Plataea).
Perhaps the best example of the phalanx's flexibility was the oblique advance made in the Battle of Leuctra. There, the Theban general Epaminondas thinned out the right flank and centre of his phalanx, and deepened his left flank to an unheard-of 50 men deep. This reversed the convention by which the right flank of the phalanx was strongest. The new arrangement allowed the Thebans to assault in strength the elite Spartan troops on the right flank of the opposing phalanx. Meanwhile, the centre and right flank of the Theban line were echeloned back, from the opposing phalanx, keeping the weakened parts of the formation from being engaged. Once the Spartan right had been routed by the Theban left, the remainder of the Spartan line also broke. Thus by heading with the powerful wing, Epaminondas was able to defeat an enemy previously thought invincible.
Philip II of Macedon spent several years in Thebes as a hostage, and paid attention to Epaminondas' innovations. When he got home he raised a revolutionary new infantry force, which was to change the face of the Greek world. Phillip's phalangites were the first force of professional soldiers in Ancient Greece (apart from Sparta). They were armed with much longer spears and were drilled more thoroughly in more complex tactics and manoeuvres. More importantly, though, Phillip's phalanx was part of a multi-faceted, combined force that included a variety of skirmishers and cavalry, most notably his famous Companion cavalry. 
The Macedonian phalanx now was used to pin the centre of the enemy line, while cavalry and more mobile infantry struck at the foe's flanks. Its supremacy over the more static armies fielded by the Greek city-states was shown at the Battle of Chaeronea, where Philip II's army crushed the allied Theban and Athenian phalanxes.