document.write( "Question 1038295: A farmer bought a number of pigs for $145. However, 8 of them died before he could sell the rest at a profit of 2 per pig. His total profit was $2. How many pigs did he originally buy? \n" ); document.write( "
Algebra.Com's Answer #652995 by Theo(13342)\"\" \"About 
You can put this solution on YOUR website!
there's an easy way to solve this.
\n" ); document.write( "since the number of pigs has to be an integer, then look for all the factors of 145.
\n" ); document.write( "you get 1 * 147 or 5 * 29 and i think nothing else.
\n" ); document.write( "it can't be 1 and it can't be 5 so it has to be either 147 or 29.
\n" ); document.write( "i went for 29 and got good results.
\n" ); document.write( "with 29 pigs bought, the cost per pig is 5 dollars.
\n" ); document.write( "8 pigs died, so 21 pigs were sold at a profit of 2 dollars apiece.
\n" ); document.write( "this means they were sold for 7 dollar each.
\n" ); document.write( "total revenue was 21 * 7 = 147 dollars.
\n" ); document.write( "total profit was 2 dollars.
\n" ); document.write( "solution looks good.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "i had a lot more trouble solving it algebraically.
\n" ); document.write( "i finally latched on to a method that provided the algebraic solution.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "let x = the number of pigs.
\n" ); document.write( "let c - the cost per pig.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "since the total cost is 145, you get x*c = 145.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "8 pigs died, so there were 21 pigs left.
\n" ); document.write( "these were sold at a profit of 2 dollars apiece.
\n" ); document.write( "the total profit was 2 dollars.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "you get (x-8) * (c+2) = 147\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "since the cost per pig was c, then the revenue per pig had to be c+2 in order to get a profit of 2 dollars per pig.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "the number of pigs sold was x-8.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "since the total profit was 2 dollars, then the total revenue had to be 147 dollars because the total cost was 145 dollars.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "the two equations you have are:\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "x*c = 145
\n" ); document.write( "(x-8) * (c+2) = 147\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "in the first equation, solve for c to get c = 145/x.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "in the second equation, replace c with 145/x to get:\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "(x-8) * (c+2) = 147 becomes (x-8) * (145/x + 2) = 147\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "simplify by performing the multiplication to get 145 + 2x - (8*145)/x - 16 = 147\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "subtract 145 and add 16 to both sides of the equation to get 2x - (8*145)/x = 18\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "multiply both sides of this equation by x to get 2x^2 - (8*145) = 18x\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "subtract 18x from both sides of this equation and simplify 8*145 to get 2x^2 - 18x - 1160 = 0\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "divide both sides of the equation by 2 to get x^2 - 9x - 580 = 0\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "factor this quadratic equation to get (x-29) * (x+20) = 0\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "solve for x to get x = 29 or x = -20.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "since the number of pigs can't be negative, then x = -20 is no good and your only valid solution is x = 29.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "when x = 29, the total cost per pig is 145/29 = 5 dollars.
\n" ); document.write( "a profit of 2 dollars per pig sold means each pig that was sold brought in 7 dollars.
\n" ); document.write( "21 * 7 = 147.
\n" ); document.write( "the total revenue was 147 and the total cost was 145 which made the total profit equal to 2 dollars.\r
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "the solution is confirmed to be good.\r
\n" ); document.write( "
\n" ); document.write( "
\n" ); document.write( "\n" ); document.write( "
\n" ); document.write( "
\n" );