Let the side of the square = x
So, the altitude of the triangle = x
and it's base = x+3
2 (area of triangle) - 18 = area of the square
area of the triangle = (1/2)height× base
and
area of the square = side^2
{ (2)(1/2)(x)(x+3)} -18 = x^2
x^2 + 3 x -18 = x^2
3x -18 =0
3x = 18
x = 6
so, the length of one side of the square = 6 units = altitude of the triangle
and the base of the triangle = 6+ 3 = 9cm.