finished the first part of derivatives