Controllability and observability of linear systems