If the amount before GST is x, then the amount after GST is x+x/20 because 5% is 5/100=1/20.
x+x/20=x(1+1/20)=(21/20)x. If you know the amount after tax then that means (21/20)x, so you find x be multiplying the amount by 20/21, because (20/21)(21/20)x=x.
Example: the amount after GST is $42, then the amount before tax is added is (20/21)42=$40.