The south gate of the Imperial Audience Hall compound was at the center of the Fujiwara palace and capital (694–710). In front of the gate, seven pits were excavated in 2016. These were remains left by flagpoles erected for the New Year’s Day ceremony in 701. Upon consideration, we found that the layout was designed based on right triangles extending from the center of the gate. The Zhoubi Suanjing describes the 3:4:5 ratio of right triangles as part of preparations for astronomical observation. The lengths of these triangles were based on multiples of 40 shaku (1 shaku = 0.295 m), because 40 was considered a lucky number, and the use of regular multiples (40, 80, 120) likely expressed a sense of public order on the ground, just as the planetary motions keep regular hours. This use of right triangles has two symbolic implications. First, it indicates the use of scientific knowledge such as astrology, and second, it is an example of the regular surveying techniques used for the construction of the ancient capital. It is known that tombs of emperors, and shrines associated with the imperial founder and deities, were built along the east–west and north–south center lines running through the gate.