Fun with functionshelp requested

  • Thread starter ability
  • Start date
  • Tags
    Fun
In summary, functions in programming are blocks of reusable code that take in input, process it, and return an output. They are useful for code reusability, organization, and efficiency. To create a function, use the keyword "function" followed by the function name, parentheses, and curly braces. To call a function, use the function name followed by parentheses. Functions can also return a value using the keyword "return."
  • #1
ability
4
0
I have a lot of questions and I know I'm supposed to show all my work but the post would be insanely long, so I will show you what answers I have come up with on the ones that I managed to get that far. I know how to do these but I often get hung up on the fractions and trying to get rid of the exponents

For functions:
f(x)= (x+1)/(x-1)
g(x)= 1/x

Find:

A. f+g
I got 2x+2/x^2-x

B. f-g
I got 0

C. f*g
I got x+1/x^2-x

D. f/g
I got x^2+1/x-1

E. f o g (x)
I got 2x/1-x


These ones I am having difficulty with, sorry for not showing my work, some answers would be very much appreciated though.

Multiply:
a. (x^2-2)^3

b. (x^2+3x+5)(x+2)

c. (2x^2-6x)(2x-4)

Divide and define restrictions:
a. (2x^3-x^2+2x-3) / (x-1)

b. (x^5-x^4-4x^3+8x^2-32x+48) / (x^2+4)

c. (x^5-1) (x-1)

Thanks again for the help, hopefully this is just the forum I was looking for!
 
Physics news on Phys.org
  • #2
For functions:
f(x)= (x+1)/(x-1)
g(x)= 1/x

First thing you need to use parenthesis to make things clear. Check your steps in these, I could not as you did not post them. An easy check is to remember function equallity means equallity for all function. values.
f(-1)=0 g(-1)=-1
Find:

A. f+g
I got 2x+2/x^2-x
no
(f+g)(-1)=f(-1)+g(-1)=-1
I would really like to see the steps that led to this, and where if anywhere you intended parenthesis
B. f-g
I got 0
no
(f-g)(-1)=f(-1)-g(-1)=0-(-1)=1
C. f*g
I got x+1/x^2-x
yes if you meant (x+1)/(x^2-x)
(f*g)(-1)=f(-1)*g(-1)=0*(-1)=0
((-1)+1)/((-1)^2-(-1))=0
D. f/g
I got x^2+1/x-1
no
(f/g)(-1)=f(-1)/g(-1)=0/(-1)=0
E. f o g (x)
I got 2x/1-x
no
(f o g)(-1)=f(g(-1))=f(-1)=0
2(-1)/1-(-1)=-2+1=-1
2(-1)/(1-(-1))=-1
These ones I am having difficulty with, sorry for not showing my work, some answers would be very much appreciated though.

Multiply:
a. (x^2-2)^3

b. (x^2+3x+5)(x+2)

c. (2x^2-6x)(2x-4)
For these remember distribution
example
(3x+2)(7x-5)
=7x(3x+2)-5(3x+2)
=21x^2+14x-15x-10
=21x^2-x-10
a(b+c)=a*b+a*c and commutitivity a*b=b*a
Divide and define restrictions:
a. (2x^3-x^2+2x-3) / (x-1)

b. (x^5-x^4-4x^3+8x^2-32x+48) / (x^2+4)

c. (x^5-1) (x-1)
use polynomial long division, factor, or rearrange to get thing that will divide
Some would restrict if the denominator is zero, likely you only want to restric if the order of the numerator is less than of the denominator. ie (x+1)/(x-1) restrict x=1 but (x-1)^4/(x-1)^3 do not. Check your book.
Here is an example
(x^3+3x^2+3x+1)/(x+1)
=(x^3+x^2+2x^2+3x+1)/(x+1)
=(x^2(x+1)+2x^2+2x+x+1)/(x+1)
=(x^2(x+1)+2x(x+1)+(x+1))/(x+1)
=(x^2+2x+1)(x+1)/(x+1)
=x^2+2x+1
 
  • #3
Show us your work at least for the first ones. As lurflurf told you, you have every one of them wrong. It should at least be obvious that since f and g are not the same, f- g cannot be 0!
 
  • #4
Thanks for the help, although I am a bit confused. These numbers you came up with are the numbers for which the domain cannot be, correct? Is that the final answer I should be coming up with?
 
  • #5
ability said:
Thanks for the help, although I am a bit confused. These numbers you came up with are the numbers for which the domain cannot be, correct? Is that the final answer I should be coming up with?
I sugested that when combining function, until you are more comfortable, that you check your self by using some numerical examples. Function equallity is defined by equallity for all numbers in the domain. So you can check if your answer is right. i.e. if (x+1)(x-1)=x^2-1 then this holds for all numbers. If a mistake is made and you think (x+1)(x-1)=x^2+1 it can be seen that this is an error because if x=2 (2+1)(2-1)=2 but 2^2+1=5. Also when combining functions make sure to exclude any problems from the domain. In problems like these the main thing to look for is zeros in denominators. See what your book says about cancelation, in many books something like x/x=1 is considered ok for all x since the numerator and denominator are zero together when x=0. You should look for mistakes in your work, and post some of you can not find them. So to combine functions just write the functions out with the desires operation, and simplify as needed. When multiplying remember distributive rules. When dividing flip and multiply. When dividing think about when denominators are zero.
Final answer should be the combined function and any domain restrictions that are appropriate.
ie
f(x)=(x+2) g(x)=(x-3)
(f/g)(x)=f(x)/g(x)
(f/g)(x)=(x+2)/(x-3)
so domain is all real numbers except 3
 

What are functions in programming?

Functions are reusable blocks of code that perform a specific task. They take in input, process it, and return an output.

Why are functions useful?

Functions allow for code reusability, making it easier to write and maintain programs. They also help with organization and efficiency.

How do I create a function?

To create a function, you use the keyword "function" followed by the function name, a pair of parentheses and curly braces. Inside the parentheses, you can specify parameters (if any) and inside the curly braces, you write the code for the function.

How do I call a function?

To call a function, you simply use the function name followed by a pair of parentheses. If the function has parameters, you pass in the values for those parameters inside the parentheses.

Can functions return a value?

Yes, functions can return a value using the keyword "return" followed by the value you want to return. This value can be stored in a variable or used in other parts of your code.

Similar threads

  • Introductory Physics Homework Help
Replies
17
Views
236
  • Introductory Physics Homework Help
Replies
3
Views
308
Replies
5
Views
333
  • Introductory Physics Homework Help
Replies
3
Views
818
  • Introductory Physics Homework Help
Replies
25
Views
208
  • Introductory Physics Homework Help
Replies
32
Views
959
  • Introductory Physics Homework Help
Replies
7
Views
621
  • Introductory Physics Homework Help
Replies
9
Views
1K
  • Introductory Physics Homework Help
Replies
11
Views
1K
  • Introductory Physics Homework Help
Replies
10
Views
863
Back
Top