I'll add one more point of why sinning in public is worse than sinning alone
if a sin is only between Allah and the sinner, I.e. no one else saw, then Allah out of his Mercy could forgive the sinner but if there are witnesses to the sin and Allah decides to punish one sinner and forgive another (who happens to be that public sinner) on day of judgement, than the witnesses can step forward and say Allah how comes you're sending that sinner to hell and this guy to heaven when we saw him do this and that sin? (I.e. the witnesses will be demanding justice) then since the witnesses are demanding justice Allah will send the public sinner to hell too!
Sorry no ref guys just heard it from a preacher in the mosque one day