The CP 161 is not a math error notice. It shows the underpaid tax according to the IRS records. CP 161 shows the tax you reported on the return, the payments the IRS applied, and the resulting underpayment the IRS has on record.
This notice is a reconciliation issue and the starting point is generally to compare the payments made from your records to the payments in the IRS records. If the payments you made reconcile with the payments recorded by the IRS, pay the balance due by the due date on the notice. If you cannot pay the balance in full, contact the IRS to possibly set up an installment agreement. If one of your payments made is missing from the IRS listing, contact the IRS with documentation of the payment - cancelled check, direct debit information, etc.
Sections of the Notice:
Sample CP 161: PDF Pages 1-4
Note that any link in the information above is updated each year automatically and will take you to the most recent version of the document at the time it is accessed.