Indonesian Journal of Electrical Engineering and Computer Science Vol. 20, No. 2, November 2020, pp. 1062~1069 ISSN: 2502-4752, DOI: 10.11591/ijeecs.v20.i2.pp1062-1069 1062 Journal homepage: http://ijeecs.iaescore.com A new algorithm for water retention on magic square Shatha A. Salman, Amal A.Ibrahim Mathematics and Computer Application, Applied Sciences, University of Technology, Iraq Article Info ABSTRACT Article history: Received Apr 20, 2020 Revised Apr 21, 2020 Accepted May 5, 2020 The article describes new algorithms for water retention using magic square, based on the properties of magic square which is defined as an n×n matrix with positive entries enabling to pouring amounts of water over the magic square and measuring the amount of water that does not leak out of the square. The new method effectiveness evaluation is confirmed by the calculation in many applications; one of them is water retention. Keywords: Algorithm Hetero magic square Magic square Ultra- magic square Water retention Copyright © 2020 Institute of Advanced Engineering and Science. All rights reserved. Corresponding Author: Shatha Assaad Salman, Department of Applied Sciences, University of Technology, Al-Sinaa Street, Baghadad, Iraq. Email: 100178@uotechnology.edu.iq 1. INTRODUCTION Magic squares being a mathematical theme of entertainment attracted the attention of many mathematicians and therefore magic squares are considered an example of the beauty of mathematics subjects and have many applications [1-6]. The first magic square is found in China and is called Lo Shu square which is a square matrix with positive integers in which all the lines (rows, column, diagonals) are equal to the same value. The magic squares attracted wide attention, which led to their transition to India, Europe and the Islamic world in order to study them and to know their characteristics. The prevailing belief then was that these squares possessed magical properties and therefore were linked in many cultures by astrology and divination [7-9]. In recent years magic squares have been linked with water retention to reach the magic squares that trap as much as possible of water. The problem of water retention is to pour water on a certain surface and calculate the amount of water that will settle inside the holes of that surface. The rest of the excess water is leaking through the edges, and thus finding maximum magic square that retaining water. Figure 1 illustrates a magic square whose height is determined by the value within each cell. Figure 1. Magic square representation