Discovering an error after publishing?
This is the sort of thing that corrections and errata are for. The journal should have a procedure for informing the editorial staff and correcting the record.  Follow it, and you should be able to fairly quickly and easily correct the record.