The purpose of this essay is to trace the historical development of geometry while focusing on how we acquired mathematical tools for describing the "shape of the universe." More specifically, our aim is to consider, without a claim to completeness, the origin of Riemannian geometry, which is indispensable to the description of the space of the universe as a "generalized curved space."But what is the meaning of "shape of the universe" ? The reader who has never encountered such an issue might say that this is a pointless question. It is surely hard to conceive of the universe as a geometric figure such as a plane or a sphere sitting in space for which we have vocabulary to describe its shape. For instance, we usually say that a plane is "flat" and "infinite," and a sphere is "round" and "finite." But in what way is it possible to make use of such phrases for the universe ? Behind this inescapable question is the fact that the universe is not necessarily the ordinary 3D (3-dimensional) space where the traditional synthetic geometry-based on a property of parallels which turns out to underly the "flatness" of space-is practiced. Indeed, as Einstein's theory of general relativity (1915) claims, the universe is possibly "curved" by gravitational effects. (To be exact, we need to handle 4D curved space-times ; but for simplicity we do not take the "time" into consideration, and hence treat the "static" universe or the universe at any instant of time unless otherwise stated. We shall also disregard possible "singularities" caused by "black holes.")An obvious problem still remains to be grappled with, however. Even if we assent to the view that the universe is a sort of geometric figure, it is impossible for us to look out over the universe all at once because we are strictly confined in it. How can we tell the shape of the universe despite that ? Before Albert Einstein (1879-1955) created his theory, mathematics had already climbed such a height as to be capable to attack this issue. In this respect, Gauss and Riemann are the names we must, first and foremost, refer to as mathematicians who intensively investigated curved surfaces and spaces with the grand vision that their observations have opened up an entirely new horizon to cosmology. In particular, Riemann's work, which completely recast three thousand years of geometry executed in "space as an a priori entity," played an absolutely decisive role when Einstein established the theory of general relativity.Gauss and Riemann were, of course, not the first who were involved in cosmology. Throughout history, especially from ancient Greece to Renaissance Europe, mathematicians were, more often than not, astronomers at the same time, and hence the links between mathematics and cosmology are ancient, if not in the