# Mixing units with functions or derivatives?

1. Jul 16, 2015

### christian0710

Hi,
How do you correctly use units when writing derivatives and functions in math?

Example

A car goes 17miles per gallon, so a function m with the equation m(g)=17g describes the distance it can go with g gallons.

And the derivative dm/dg = 17 miles/gallon.

Question: could you write the equation as m(g)=17(miles/gallon)*g or is that incorrect?

2. Jul 16, 2015

### FactChecker

Yes. That would be correct.

3. Jul 16, 2015

### mathman

Your question is confusing. It looks like you are asking is m(g)=17g correct, if m(g)=17g, except you are writing a label for 17?

4. Jul 16, 2015

### tommyxu3

When you are defining a variable, you can give it its unit right away or not.
So if you say $m$ is the distance the car can drive, then the variable $m$ has already contained the unit, maybe miles. So you should write:$$m=17mile/gallon\cdot g.$$You can see here my $g$ has also contained its unit: gallon, but 17 not, so then I write 17mile/gallon in the equation.
By the way, we seldom use $m$ to represent the distance because it is more often used to say mass, but it doesn't matter while it just depends on one's habits.

5. Jul 17, 2015

### HallsofIvy

It should be evident that if m is a distance, measured in miles, and g is a quantity of gasoline, measured in gallons, then in order that "m (miles)= k g(gallons) make sense, k must be in "miles per gallon" so that (k miles/gallon)(g gallons)= kg miles.