Algebraic geometry is one of the dynamic branches of pure mathematics, which has received a large part of the current research of mathematical experts in the world. In this branch of science, geometric issues are expressed in algebraic language. With the advent of technology in recent decades, the advancement of computer speed and processing power, the computational algebraic geometry branch has been increasingly considered. Today, we are witnessing the introduction of various algorithms for solving algebraic geometry problems by various software. On the other hand, mathematical optimization is one of the most powerful branches of applied mathematics, which today has vast applications in other sciences (including economics, social sciences, and engineering). In this paper, we intend to introduce the reader to the algebraic geometry by solving some problems by exploring how to use algebraic geometry methods to solve optimization problems. We will explain these methods by expressing an example of optimization. Finally, we will work out an optimization code by coding in one of the computational algebraic geometry software called CoCoA.