The "Tax Basis" is the fulcrum of this transactiion. Tax Basis is calculated typically as follows:
Purchase Price + Improvement Costs - (Accumulated Depreciation) (Depreciation may or may not apply) = Tax Basis. The Tax Basis is then compared to the Sales proceeds ($50,000) to calculate gain or loss. If the Sales proceeds exceed Tax Basis the difference is the amount of the gain. In reverse and you have a loss.