written solutions for first three problems