Working .r for inveting matrix