Transfer matrix approach to surface states